UNPKG

zdpjs_webrtc

Version:
4,039 lines (1,010 loc) 77.6 kB
<!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8"> <title>EasyRTC Documentation</title> <script src="scripts/prettify/prettify.js"> </script> <script src="scripts/prettify/lang-css.js"> </script> <!--[if lt IE 9]> <script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script> <![endif]--> <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css"> <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css"> <link href="../assets/easyrtc-docs-jsdoc-styles-1.css" media="all" rel="stylesheet" /> </head> <body> <header class="template"> <div class="wrapper-content"> <a href="../index.html"><img src="../assets/easyrtc-logo.png" alt="EasyRTC Documentation"></a> <h1 title="EasyRTC Documentation">Documentation</h1> </div> </header> <div class="wrapper-docs"> <nav> <h2><a href="../index.html">Docs Home</a></h2> <h3>EasyRTC Guides</h3> <ul> <li><a href="../easyrtc_faq.html">FAQ</a></li> <li><a href="../easyrtc_gettingStarted.html">Getting Started</a></li> <li><a href="../easyrtc_server_install.html">EasyRTC Server: Installation</a></li> <li><a href="../easyrtc_client_tutorial.html">EasyRTC Framework Tutorial</a></li> <li><a href="../easyrtc_rooms.html">Rooms</a></li> <li><a href="../easyrtc_server_configuration.html">EasyRTC Server: Configuration</a></li> <li><a href="../easyrtc_server_events.html">EasyRTC Server: Events</a></li> <li><a href="../easyrtc_server_ice.html">EasyRTC Server: ICE Configuration</a></li> <li><a href="../easyrtc_with_other_servers.html">Using Alongside Other Servers</a></li> <li><a href="../easyrtc_server_ssl.html">EasyRTC Server: Using SSL</a></li> <li><a href="../easyrtc_webrtc_problems.html">WebRTC Problems and Possible Fixes</a></li> <li><a href="../easyrtc_upcoming_features.html">Upcoming Features</a></li> <li><a href="../easyrtc_changelog.html">Change Log</a></li> </ul> <h3>EasyRTC Client Classes</h3> <ul> <li><a href="../client-api/Easyrtc.html">Easyrtc</a></li> <li><a href="../client-api/Easyrtc_App.html">Easyrtc_App</a></li> <li><a href="../client-api/Easyrtc_ft.html">Easyrtc_ft</a></li> <li><a href="../client-api/Easyrtc_IframeCapture.html">Easyrtc_IframeCapture</a></li> <li><a href="../client-api/Easyrtc_No_IframeCapture.html">Easyrtc_No_IframeCapture</a></li> <li><a href="../client-api/Easyrtc_Rates.html">Easyrtc_Rates</a></li> <li><a href="../client-api/Easyrtc_Recorder.html">Easyrtc_Recorder</a></li> </ul> <h3>EasyRTC Server Modules</h3> <ul> <li><a href="../server-api/module-easyrtc_default_event_listeners.html">easyrtc_default_event_listeners</a></li> <li><a href="../server-api/module-easyrtc_default_options.html">easyrtc_default_options</a></li> <li><a href="../server-api/module-easyrtc_private_obj.html">easyrtc_private_obj</a></li> <li><a href="../server-api/module-easyrtc_public_obj.html">easyrtc_public_obj</a></li> <li><a href="../server-api/module-easyrtc_util.html">easyrtc_util</a></li> <li><a href="../server-api/module-general_util.html">general_util</a></li> </ul> <h3>EasyRTC Server Classes</h3> <ul> <li><a href="../server-api/module-easyrtc_default_event_listeners-eventListener.html">eventListener</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.html">pub</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.events.html">events</a></li> <li><a href="../server-api/module-easyrtc_public_obj-pub.util.html">util</a></li> <li><a href="../server-api/module-easyrtc_util-eu.html">eu</a></li> <li><a href="../server-api/module-general_util-g.html">g</a></li> <li><a href="../server-api/pub.appObj.html">appObj</a></li> <li><a href="../server-api/pub.appObj.connectionObj.html">connectionObj</a></li> <li><a href="../server-api/pub.appObj.connectionObj.connectionRoomObj.html">connectionRoomObj</a></li> <li><a href="../server-api/pub.appObj.roomObj.html">roomObj</a></li> <li><a href="../server-api/pub.appObj.sessionObj.html">sessionObj</a></li> </ul> </nav> <div class="easyrtc-docs-content"> <div id="main"> <h1 class="page-title">Class: pub</h1> <section> <header> <h2> <span class="ancestors"><a href="module-easyrtc_public_obj.html">easyrtc_public_obj</a>~</span>pub</h2> </header> <article> <div class="container-overview"> <h4 class="name" id="pub"><span class="type-signature"></span>new pub<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> The public object which is returned by the EasyRTC listen() function. Contains all public methods for interacting with EasyRTC server. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line26">line 26</a> </li></ul></dd> </dl> </div> <h3 class="subsection-title">Classes</h3> <dl> <dt><a href="module-easyrtc_public_obj-pub.events.html">events</a></dt> <dd></dd> <dt><a href="module-easyrtc_public_obj-pub.util.html">util</a></dt> <dd></dd> </dl> <h3 class="subsection-title">Members</h3> <h4 class="name" id=".events.defaultListeners"><span class="type-signature">(static) </span>events.defaultListeners<span class="type-signature"></span></h4> <div class="description"> Map of EasyRTC event listener names to their default functions. This map can be used to run a default function manually. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line256">line 256</a> </li></ul></dd> </dl> <h4 class="name" id=".events.emit"><span class="type-signature">(static) </span>events.emit<span class="type-signature"></span></h4> <div class="description"> Expose event listener's emit function. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line206">line 206</a> </li></ul></dd> </dl> <h4 class="name" id=".util.ApplicationError"><span class="type-signature">(static) </span>util.ApplicationError<span class="type-signature"></span></h4> <div class="description"> Custom Error Object for EasyRTC Application Errors. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line370">line 370</a> </li></ul></dd> </dl> <h4 class="name" id=".util.ApplicationWarning"><span class="type-signature">(static) </span>util.ApplicationWarning<span class="type-signature"></span></h4> <div class="description"> Custom Error Object for EasyRTC Application Warnings. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line380">line 380</a> </li></ul></dd> </dl> <h3 class="subsection-title">Methods</h3> <h4 class="name" id=".app"><span class="type-signature">(static) </span>app<span class="signature">(appName<span class="signature-attributes">nullable</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Contains the methods for interfacing with an EasyRTC application. The callback will receive an application object upon successful retrieval of application. The callback may receive an Error object if unsuccessful. Depending on the severity, known errors have an "instanceof" ApplicationWarning or ApplicationError. The function does return an application object which is useful for chaining, however the callback approach is safer and provides additional information in the event of an error. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>appName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;nullable><br> </td> <td class="description last">Application name which uniquely identifies it on the server. Uses default application if null.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">appCallback</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Callback with error and application object</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line1180">line 1180</a> </li></ul></dd> </dl> <h4 class="name" id=".createApp"><span class="type-signature">(static) </span>createApp<span class="signature">(appName, options<span class="signature-attributes">nullable</span>, callback<span class="signature-attributes">opt</span>)</span><span class="type-signature"></span></h4> <div class="description"> Creates a new EasyRTC application with default values. If a callback is provided, it will receive the new application object. The callback may receive an Error object if unsuccessful. Depending on the severity, known errors have an "instanceof" ApplicationWarning or ApplicationError. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>appName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">Application name which uniquely identifies it on the server.</td> </tr> <tr> <td class="name"><code>options</code></td> <td class="type"> <span class="param-type">object</span> </td> <td class="attributes"> &lt;nullable><br> </td> <td class="description last">Options object with options to apply to the application. May be null.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">appCallback</span> </td> <td class="attributes"> &lt;optional><br> </td> <td class="description last">Callback with error and application object</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line1088">line 1088</a> </li></ul></dd> </dl> <h4 class="name" id=".events.emitDefault"><span class="type-signature">(static) </span>events.emitDefault<span class="signature">(eventName, &hellip;eventParam)</span><span class="type-signature"></span></h4> <div class="description"> Runs the default EasyRTC listener for a given event. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">EasyRTC event name.</td> </tr> <tr> <td class="name"><code>eventParam</code></td> <td class="type"> <span class="param-type">*</span> </td> <td class="attributes"> &lt;repeatable><br> </td> <td class="description last">The event parameters</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line215">line 215</a> </li></ul></dd> </dl> <h4 class="name" id=".events.on"><span class="type-signature">(static) </span>events.on<span class="signature">(eventName, listener)</span><span class="type-signature"></span></h4> <div class="description"> Sets listener for a given EasyRTC event. Only one listener is allowed per event. Any other listeners for an event are removed before adding the new one. See the events documentation for expected listener parameters. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Listener name.</td> </tr> <tr> <td class="name"><code>listener</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Function to be called when listener is fired</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line292">line 292</a> </li></ul></dd> </dl> <h4 class="name" id=".events.removeAllListeners"><span class="type-signature">(static) </span>events.removeAllListeners<span class="signature">(eventName<span class="signature-attributes">nullable</span>)</span><span class="type-signature"></span></h4> <div class="description"> Removes all listeners for an event. If there is a default EasyRTC listener, it will be added. If eventName is `null`, all events will be removed than the defaults will be restored. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> &lt;nullable><br> </td> <td class="description last">Listener name. If `null`, then all events will be removed.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line308">line 308</a> </li></ul></dd> </dl> <h4 class="name" id=".events.setDefaultListener"><span class="type-signature">(static) </span>events.setDefaultListener<span class="signature">(eventName)</span><span class="type-signature"></span></h4> <div class="description"> Resets the listener for a given event to the default listener. Removes other listeners. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>eventName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">EasyRTC event name.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line229">line 229</a> </li></ul></dd> </dl> <h4 class="name" id=".events.setDefaultListeners"><span class="type-signature">(static) </span>events.setDefaultListeners<span class="signature">()</span><span class="type-signature"></span></h4> <div class="description"> Resets the listener for all EasyRTC events to the default listeners. Removes all other listeners. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line241">line 241</a> </li></ul></dd> </dl> <h4 class="name" id=".getAppNames"><span class="type-signature">(static) </span>getAppNames<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Sends an array of all application names to a callback. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and array containing all application names.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line51">line 51</a> </li></ul></dd> </dl> <h4 class="name" id=".getAppWithEasyrtcid"><span class="type-signature">(static) </span>getAppWithEasyrtcid<span class="signature">(easyrtcid, callback)</span><span class="type-signature"></span></h4> <div class="description"> Gets app object for application which has an authenticated client with a given easyrtcid </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>easyrtcid</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Unique identifier for an EasyRTC connection.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and application object</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line66">line 66</a> </li></ul></dd> </dl> <h4 class="name" id=".getConnectionCount"><span class="type-signature">(static) </span>getConnectionCount<span class="signature">(callback)</span><span class="type-signature"></span></h4> <div class="description"> Sends the count of the number of connections to the server to a provided callback. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and array containing all easyrtcids.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line83">line 83</a> </li></ul></dd> </dl> <h4 class="name" id=".getConnectionCountSync"><span class="type-signature">(static) </span>getConnectionCountSync<span class="signature">()</span><span class="type-signature"> &rarr; {Number}</span></h4> <div class="description"> Sends the count of the number of connections to the server to a provided callback. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line93">line 93</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> The current number of connections in a room. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Number</span> </dd> </dl> <h4 class="name" id=".getConnectionWithEasyrtcid"><span class="type-signature">(static) </span>getConnectionWithEasyrtcid<span class="signature">(easyrtcid, callback)</span><span class="type-signature"></span></h4> <div class="description"> Gets connection object for connection which has an authenticated client with a given easyrtcid </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>easyrtcid</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">EasyRTC unique identifier for a socket connection.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and connection object</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line108">line 108</a> </li></ul></dd> </dl> <h4 class="name" id=".getOption"><span class="type-signature">(static) </span>getOption<span class="signature">(optionName)</span><span class="type-signature"> &rarr; {*}</span></h4> <div class="description"> Gets individual option value. The option value returned is for the server level. Note that some options can be set at the application or room level. If an option has not been set at the room level, it will check to see if it has been set at the application level, if not it will revert to the server level. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>optionName</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">Option name</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line134">line 134</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Option value (can be any JSON type) </div> <dl> <dt> Type </dt> <dd> <span class="param-type">*</span> </dd> </dl> <h4 class="name" id=".getVersion"><span class="type-signature">(static) </span>getVersion<span class="signature">()</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Gets EasyRTC Version. The format is in a major.minor.patch format with an optional letter following denoting alpha or beta status. The version is retrieved from the package.json file located in the EasyRTC project root folder. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line148">line 148</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> EasyRTC Version </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".isApp"><span class="type-signature">(static) </span>isApp<span class="signature">(appName, callback)</span><span class="type-signature"></span></h4> <div class="description"> Determine if a given application name has been defined. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>appName</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Application name which uniquely identifies it on the server.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="description last">Callback with error and boolean of whether application is defined.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line1074">line 1074</a> </li></ul></dd> </dl> <h4 class="name" id=".setOption"><span class="type-signature">(static) </span>setOption<span class="signature">(optionName, optionValue)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Sets individual option. The option value set is for the server level. Note that some options can be set at the application or room level. If an option has not been set at the room level, it will check to see if it has been set at the application level, if not it will revert to the server level. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>optionName</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Option name</td> </tr> <tr> <td class="name"><code>optionValue</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Option value</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line173">line 173</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> true on success, false on failure </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".util.ConnectionError"><span class="type-signature">(static) </span>util.ConnectionError<span class="signature">(msg)</span><span class="type-signature"> &rarr; {Error}</span></h4> <div class="description"> Custom Error Object for EasyRTC C Errors. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>msg</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Text message describing the error.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line391">line 391</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> <h4 class="name" id=".util.ConnectionWarning"><span class="type-signature">(static) </span>util.ConnectionWarning<span class="signature">(msg)</span><span class="type-signature"> &rarr; {Error}</span></h4> <div class="description"> Custom Error Object for EasyRTC Connection Warnings. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>msg</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="description last">Text message describing the error.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line401">line 401</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Error</span> </dd> </dl> <h4 class="name" id=".util.deepCopy"><span class="type-signature">(static) </span>util.deepCopy<span class="signature">(input)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Performs a deep copy of an object, returning the duplicate. Do not use on objects with circular references. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>input</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="description last">Input variable (or object) to be copied.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line332">line 332</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> New copy of variable. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".util.getAvailableEasyrtcid"><span class="type-signature">(static) </span>util.getAvailableEasyrtcid<span class="signature">()</span><span class="type-signature"> &rarr; {String}</span></h4> <div class="description"> Returns a random available easyrtcid. </div> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line432">line 432</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Available easyrtcid. A unique identifier for an EasyRTC connection. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">String</span> </dd> </dl> <h4 class="name" id=".util.getErrorMsg"><span class="type-signature">(static) </span>util.getErrorMsg<span class="signature">(errorCode)</span><span class="type-signature"> &rarr; {Object}</span></h4> <div class="description"> Returns an EasyRTC message error object for a specific error code. This is meant to be emitted or returned to a websocket client. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>errorCode</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">EasyRTC error code associated with an error.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line441">line 441</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> EasyRTC message error object for the specific error code. </div> <dl> <dt> Type </dt> <dd> <span class="param-type">Object</span> </dd> </dl> <h4 class="name" id=".util.getErrorText"><span class="type-signature">(static) </span>util.getErrorText<span class="signature">(errorCode)</span><span class="type-signature"> &rarr; {string}</span></h4> <div class="description"> Returns human readable text for a given error code. If an unknown error code is provided, a null value will be returned. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>errorCode</code></td> <td class="type"> <span class="param-type">String</span> </td> <td class="description last">EasyRTC error code associated with an error.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line466">line 466</a> </li></ul></dd> </dl> <h5>Returns:</h5> <div class="param-desc"> Human readable error string </div> <dl> <dt> Type </dt> <dd> <span class="param-type">string</span> </dd> </dl> <h4 class="name" id=".util.isError"><span class="type-signature">(static) </span>util.isError<span class="signature">(Will)</span><span class="type-signature"> &rarr; {Boolean}</span></h4> <div class="description"> Determines if an Error object is an instance of ApplicationError, ConnectionError, or ServerError. If it is, it will return true. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>Will</code></td> <td class="type"> <span class="param-type">*</span> | <span class="param-type">Error</span> </td> <td class="description last">accept any value, but will only return true for appropriate error objects.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line350">line 350</a> </li></ul></dd> </dl> <h5>Returns:</h5> <dl> <dt> Type </dt> <dd> <span class="param-type">Boolean</span> </dd> </dl> <h4 class="name" id=".util.isValidIncomingMessage"><span class="type-signature">(static) </span>util.isValidIncomingMessage<span class="signature">(type, msg, appObj<span class="signature-attributes">nullable</span>, callback)</span><span class="type-signature"></span></h4> <div class="description"> Checks an incoming EasyRTC message to determine if it is syntactically valid. </div> <h5>Parameters:</h5> <table class="params"> <thead> <tr> <th>Name</th> <th>Type</th> <th>Attributes</th> <th class="last">Description</th> </tr> </thead> <tbody> <tr> <td class="name"><code>type</code></td> <td class="type"> <span class="param-type">string</span> </td> <td class="attributes"> </td> <td class="description last">The Socket.IO message type. Expected values are (easyrtcAuth|easyrtcCmd|easyrtcMsg)</td> </tr> <tr> <td class="name"><code>msg</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> </td> <td class="description last">Message object which contains the full message from a client; this can include the standard msgType and msgData fields.</td> </tr> <tr> <td class="name"><code>appObj</code></td> <td class="type"> <span class="param-type">Object</span> </td> <td class="attributes"> &lt;nullable><br> </td> <td class="description last">EasyRTC application object. Contains methods used for identifying and managing an application.</td> </tr> <tr> <td class="name"><code>callback</code></td> <td class="type"> <span class="param-type">function</span> </td> <td class="attributes"> </td> <td class="description last">Callback with error, a boolean of whether message if valid, and a string indicating the error code if the message is invalid.</td> </tr> </tbody> </table> <dl class="details"> <dt class="tag-source">Source:</dt> <dd class="tag-source"><ul class="dummy"><li> <a href="easyrtc_public_obj.js.html">easyrtc_public_obj.js</a>, <a href="easyrtc_public_obj.js.html#line712">line 712</a> </li></ul></dd> </dl> <h4 class="name" id=".util.isWarning"><span class="type-signature">(st