new connectionObj()
- Source:
Classes
Members
(static) connectionObj.events
Expose all event functions
- Source:
(static) connectionObj.util
Expose all utility functions
- Source:
Methods
(static) connectionObj.emitRoomDataDelta(isLeavingAllRooms, callback)
Emits the roomData message with a clientListDelta for the current connection to other connections in rooms this connection is in.
Note: To send listDeltas for individual rooms, use connectionRoomObj.emitRoomDataDelta
Parameters:
Name | Type | Description |
---|---|---|
isLeavingAllRooms |
Boolean | Indicator if connection is leaving all rooms. Meant to be used upon disconnection / logoff. |
callback |
function | Callback of form (err, roomDataObj) which will contain the roomDataObj including all updated rooms of the connection and is designed to be returnable to the connection. |
- Source:
(static) connectionObj.generateRoomClientList(roomStatusopt, nullable, roomMapnullable, callback)
Generates a full room clientList object for the given connection
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
roomStatus |
string |
<optional> <nullable> |
"join" | Room status which allow for values of "join"|"update"|"leave". |
roomMap |
Object |
<nullable> |
Map of rooms to generate connection clientList for. If null, then all rooms will be used. | |
callback |
function | Callback which includes a formed roomData object . |
- Source:
(static) connectionObj.generateRoomDataDelta(isLeavingRoom, callback)
Generates a delta roomData object for the current user including all rooms the user is in. The result can be selectively parsed to deliver delta roomData objects to other clients.
Parameters:
Name | Type | Description |
---|---|---|
isLeavingRoom |
Boolean | Indicates if connection is in the process of leaving the room. |
callback |
function | Callback of form (err, roomDataDelta). |
- Source:
(static) connectionObj.generateRoomList(callback)
Generates the roomList message object
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Callback with error and roomList object. |
- Source:
(static) connectionObj.getApp() → {Object}
Returns the application object to which the connection belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
The application object
- Type
- Object
(static) connectionObj.getAppName() → {string}
Returns the application name for the application to which the connection belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
The application name
- Type
- string
(static) connectionObj.getEasyrtcid() → {string}
Returns the easyrtcid for the connection. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
Returns the connection's easyrtcid, which is the EasyRTC unique identifier for a socket connection.
- Type
- string
(static) connectionObj.getField(fieldName, callback)
Returns connection level field object for a given field name to a provided callback.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | Field name |
callback |
function | Callback with error and field object (any type) |
- Source:
(static) connectionObj.getFields(limitToIsShared, callback)
Returns an object containing all field names and values within the connection to a provided callback. Can be limited to fields with isShared option set to true.
Parameters:
Name | Type | Description |
---|---|---|
limitToIsShared |
boolean | Limits returned fields to those which have the isShared option set to true. |
callback |
function | Callback with error and object containing field names and values. |
- Source:
(static) connectionObj.getFieldSync(fieldName) → {Object}
Returns connection level field object for a given field name. If the field is not set, it will return a field object will a null field value. This is a synchronous function, thus may not be available in custom cases where state is not kept in memory.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | Field name |
- Source:
Returns:
Field object
- Type
- Object
(static) connectionObj.getFieldValueSync(fieldName) → (nullable) {*}
Returns connection level field value for a given field name. If the field is not set, it will return a null field value. This is a synchronous function, thus may not be available in custom cases where state is not kept in memory.
Parameters:
Name | Type | Description |
---|---|---|
fieldName |
string | Field name |
- Source:
Returns:
Field value
- Type
- *
(static) connectionObj.getRoomNames(callback)
Returns an array of all room names which connection has entered.
Parameters:
Name | Type | Description |
---|---|---|
callback |
function | Callback with error and array of room names. |
- Source:
(static) connectionObj.getSession() → {Object}
Returns the session object to which the connection belongs (if one exists). Returns a null if connection is not attached to a session (such as when sessions are disabled). Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
The session object. May be null if connection has not been joined to a session.
- Type
- Object
(static) connectionObj.getUsername() → {String}
Returns the username associated with the connection. Returns NULL if no username has been set.
Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
The username associated with the connection.
- Type
- String
(static) connectionObj.isAuthenticated() → {Boolean}
Gets connection authentication status for the connection. It is possible for a connection to become disconnected and keep the authenticated flag. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
Authentication status
- Type
- Boolean
(static) connectionObj.isConnected() → {Boolean}
Gets connection status for the connection. It is possible for a connection to be considered connected without being authenticated. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
- Source:
Returns:
Connection status
- Type
- Boolean
(static) connectionObj.isInRoom(roomName, callback)
Returns a boolean to the callback indicating if connection is in a given room
Parameters:
Name | Type | Description |
---|---|---|
roomName |
string | Room name which uniquely identifies a room within an EasyRTC application. |
callback |
function | Callback with error and a boolean indicating if connection is in a room.. |
- Source:
(static) connectionObj.joinRoom(roomName, callback)
Joins an existing room, returning a connectionRoom object.
Parameters:
Name | Type | Description |
---|---|---|
roomName |
string | Room name which uniquely identifies a room within an EasyRTC application. |
callback |
function | Callback with error and object containing EasyRTC connection room object (same as calling room(roomName)) |
- Source:
(static) connectionObj.joinSession(easyrtcsid, next)
Joins the connection to a specified session. A connection can only be assigned to one session.
Parameters:
Name | Type | Description |
---|---|---|
easyrtcsid |
string | EasyRTC session identifier |
next |
nextCallback | A success callback of form next(err). |
- Source:
(static) connectionObj.removeConnection(next)
Removes a connection object. Does not (currently) remove connection from rooms or groups.
Parameters:
Name | Type | Description |
---|---|---|
next |
nextCallback | A success callback of form next(err). |
- Source:
(static) connectionObj.room(roomName, callback)
Gets room object for a given room name. Returns null if room not found.
The returned room object includes functions for managing room fields.
Parameters:
Name | Type | Description |
---|---|---|
roomName |
string | Room name which uniquely identifies a room within an EasyRTC application. |
callback |
function | Callback with error and object containing EasyRTC connection room object. |
- Source:
(static) connectionObj.setAuthenticated(isAuthenticated, next)
Sets connection authentication status for the connection.
Parameters:
Name | Type | Description |
---|---|---|
isAuthenticated |
Boolean | True/false as to if the connection should be considered authenticated. |
next |
nextCallback | A success callback of form next(err). |
- Source:
(static) connectionObj.setCredential(credentialnullable, next)
Sets the credential for the connection.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
credential |
* |
<nullable> |
Credential for the connection. Can be any JSON object. |
next |
nextCallback | A success callback of form next(err). |
- Source:
(static) connectionObj.setField(fieldName, fieldValue, fieldOptionnullable, nextopt)
Sets connection field value for a given field name.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
fieldName |
string | Must be formatted according to "fieldNameRegExp" option. | |
fieldValue |
Object | ||
fieldOption |
Object |
<nullable> |
Field options (such as isShared which defaults to false) |
next |
nextCallback |
<optional> |
A success callback of form next(err). Possible err will be instanceof (ApplicationWarning). |
- Source:
(static) connectionObj.setPresence(presenceObj, next)
Sets the presence object for the connection.
Parameters:
Name | Type | Description |
---|---|---|
presenceObj |
Object | A presence object. |
next |
nextCallback | A success callback of form next(err). |
- Source:
(static) connectionObj.setUsername(usernamenullable, next)
Sets the username string for the connection.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
username |
string |
<nullable> |
Username to assign to the connection. |
next |
nextCallback | A success callback of form next(err). |
- Source: