new util()
General utility functions are grouped in this util object. For convenience, this class has also been attached to the application, connection, session, and room classes.
- Source:
- easyrtc_public_obj.js, line 296
Members
-
<static> ApplicationError
-
Custom Error Object for EasyRTC Application Errors.
- Source:
- easyrtc_public_obj.js, line 345
-
<static> ApplicationWarning
-
Custom Error Object for EasyRTC Application Warnings.
- Source:
- easyrtc_public_obj.js, line 355
Methods
-
<static> ConnectionError(msg) → {Error}
-
Custom Error Object for EasyRTC C Errors.
Parameters:
Name Type Description msg
string Text message describing the error. - Source:
- easyrtc_public_obj.js, line 366
Returns:
- Type
- Error
-
<static> ConnectionWarning(msg) → {Error}
-
Custom Error Object for EasyRTC Connection Warnings.
Parameters:
Name Type Description msg
string Text message describing the error. - Source:
- easyrtc_public_obj.js, line 376
Returns:
- Type
- Error
-
<static> deepCopy(input) → {Object}
-
Performs a deep copy of an object, returning the duplicate. Do not use on objects with circular references.
Parameters:
Name Type Description input
Object Input variable (or object) to be copied. - Source:
- easyrtc_public_obj.js, line 307
Returns:
New copy of variable.- Type
- Object
-
<static> getErrorMsg(errorCode) → {Object}
-
Returns an EasyRTC message error object for a specific error code. This is meant to be emitted or returned to a websocket client.
Parameters:
Name Type Description errorCode
String EasyRTC error code associated with an error. - Source:
- easyrtc_public_obj.js, line 407
Returns:
EasyRTC message error object for the specific error code.- Type
- Object
-
<static> getErrorText(errorCode) → {string}
-
Returns human readable text for a given error code. If an unknown error code is provided, a null value will be returned.
Parameters:
Name Type Description errorCode
String EasyRTC error code associated with an error. - Source:
- easyrtc_public_obj.js, line 432
Returns:
Human readable error string- Type
- string
-
<static> isError(Will) → {Boolean}
-
Determines if an Error object is an instance of ApplicationError, ConnectionError, or ServerError. If it is, it will return true.
Parameters:
Name Type Description Will
* | Error accept any value, but will only return true for appropriate error objects. - Source:
- easyrtc_public_obj.js, line 325
Returns:
- Type
- Boolean
-
<static> isValidIncomingMessage(type, msg, appObj, callback)
-
Checks an incoming EasyRTC message to determine if it is syntactically valid.
Parameters:
Name Type Argument Description type
string The Socket.IO message type. Expected values are (easyrtcAuth|easyrtcCmd|easyrtcMsg) msg
Object Message object which contains the full message from a client; this can include the standard msgType and msgData fields. appObj
Object <nullable>
EasyRTC application object. Contains methods used for identifying and managing an application. callback
function(?Error, boolean, string) Callback with error, a boolean of whether message if valid, and a string indicating the error code if the message is invalid. - Source:
- easyrtc_public_obj.js, line 625
-
<static> isWarning(Will) → {Boolean}
-
Determines if an Error object is an instance of ApplicationWarning, ConnectionWarning, or ServerWarning. If it is, it will return true.
Parameters:
Name Type Description Will
* | Error accept any value, but will only return true for appropriate error objects. - Source:
- easyrtc_public_obj.js, line 335
Returns:
- Type
- Boolean
-
<static> log(level, logText, logFields)
-
General logging function which emits a log event so long as the log level has a severity equal or greater than e.option.logLevel
Parameters:
Name Type Argument Description level
string Log severity level. Can be ("debug"|"info"|"warning"|"error") logText
string Text for log. logFields
* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. - Source:
- easyrtc_public_obj.js, line 520
-
<static> logDebug(logText, logFields)
-
Convenience function for logging "debug" level items.
Parameters:
Name Type Argument Description logText
string Text for log. logFields
* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. - Source:
- easyrtc_public_obj.js, line 549
-
<static> logError(logText, logFields)
-
Convenience function for logging "error" level items.
Parameters:
Name Type Argument Description logText
string Text for log. logFields
* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. - Source:
- easyrtc_public_obj.js, line 582
-
<static> logInfo(logText, logFields)
-
Convenience function for logging "info" level items.
Parameters:
Name Type Argument Description logText
string Text for log. logFields
* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. - Source:
- easyrtc_public_obj.js, line 560
-
<static> logWarning(logText, logFields)
-
Convenience function for logging "warning" level items.
Parameters:
Name Type Argument Description logText
string Text for log. logFields
* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. - Source:
- easyrtc_public_obj.js, line 571
-
<static> nextToNowhere(err)
-
An empty dummy function, which is designed to be used as a default callback in functions when none has been provided.
Parameters:
Name Type Description err
Error Error object - Source:
- easyrtc_public_obj.js, line 315
-
<static> sendSessionCookie(req, res)
-
Will attempt to deliver an EasyRTC session id via a cookie. Requires that session management be enabled from within Express.
Parameters:
Name Type Description req
Object Http request object res
Object Http result object - Source:
- easyrtc_public_obj.js, line 965
-
<static> ServerError(msg) → {Error}
-
Custom Error Object for EasyRTC Server Errors.
Parameters:
Name Type Description msg
string Text message describing the error. - Source:
- easyrtc_public_obj.js, line 387
Returns:
- Type
- Error
-
<static> ServerWarning(msg) → {Error}
-
Custom Error Object for EasyRTC Server Warnings.
Parameters:
Name Type Description msg
string Text message describing the error. - Source:
- easyrtc_public_obj.js, line 398
Returns:
- Type
- Error
-
<static> updateCheck()
-
Checks with EasyRTC site for latest version. Writes to the log if a version can be found. If connection cannot be established than no error will be shown.
- Source:
- easyrtc_public_obj.js, line 590