new appObj()
The primary method for interfacing with an EasyRTC application.
Classes
Members
-
<static> appObj.events
-
Expose all event functions
-
<static> appObj.util
-
Expose all utility functions
Methods
-
<static> appObj.connection(easyrtcid, callback)
-
Gets connection object for a given connection key. Returns null if connection not found. The returned connection object includes functions for managing connection fields.
Parameters:
Name Type Description easyrtcid
string EasyRTC unique identifier for a socket connection. callback
connectionCallback Callback with error and object containing EasyRTC connection object. -
<static> appObj.createConnection(easyrtcid, socketId, callback)
-
Creates a new connection with a provided connection key
Parameters:
Name Type Description easyrtcid
string EasyRTC unique identifier for a socket connection. socketId
string Socket.io socket identifier for a socket connection. callback
function Callback with error and object containing EasyRTC connection object (same as calling connection(easyrtcid)) -
<static> appObj.createRoom(roomName, options, callback)
-
Creates a new room, sending the resulting room object to a provided callback.
Parameters:
Name Type Argument Description roomName
string Room name which uniquely identifies a room within an EasyRTC application. options
object <nullable>
Options object with options to apply to the room. May be null. callback
function Callback with error and object containing EasyRTC room object (same as calling appObj.room(roomName)) -
<static> appObj.createSession(easyrtcsid, callback)
-
Creates a new session with a provided easyrtcsid
Parameters:
Name Type Description easyrtcsid
string EasyRTC Session Identifier. Must be formatted according to "easyrtcsidRegExp" option. callback
function Callback with error and object containing EasyRTC session object (same as calling session(easyrtcsid)) -
<static> appObj.deleteRoom(roomName, callback)
-
Delete an existing room, providing the room is empty.
Parameters:
Name Type Description roomName
string Room name which uniquely identifies a room within an EasyRTC application. callback
function Callback with error and true if a room was deleted. -
<static> appObj.getAppName() → {string}
-
Returns the application name for the application. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
Returns:
The application name.- Type
- string
-
<static> appObj.getConnectedEasyrtcidsWithUsername(username, callback)
-
Returns an array of all easyrtcids connected to the application associated with a given username
Parameters:
Name Type Description username
string Username to search for. callback
function Callback with error and array of easyrtcids. -
<static> appObj.getConnectedEasyrtcidsWithUsernameSync(username) → {Array.<string>}
-
Returns an array of all easyrtcids connected to the application associated with a given username
Parameters:
Name Type Description username
string Username to search for. Returns:
array of easyrtcids.- Type
- Array.<string>
-
<static> appObj.getConnectionCount(callback)
-
Sends the count of the number of connections in the app to a provided callback.
Parameters:
Name Type Description callback
function Callback with error and array containing all easyrtcids. -
<static> appObj.getConnectionCountSync() → {Number}
-
Sends the count of the number of connections in the app to a provided callback.
Returns:
The current number of connections in a room.- Type
- Number
-
<static> appObj.getConnectionEasyrtcids(callback)
-
Returns an array of all easyrtcids connected to the application
Parameters:
Name Type Description callback
function Callback with error and array of easyrtcids. -
<static> appObj.getEasyrtcsids(callback)
-
Returns an array of all easyrtcsids within the application
Parameters:
Name Type Description callback
function Callback with error and array containing easyrtcsids. -
<static> appObj.getField(fieldName, callback)
-
Returns application 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) -
<static> appObj.getFields(limitToIsShared, callback)
-
Returns an object containing all field names and values within the application. 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. -
<static> appObj.getFieldSync(fieldName) → {Object}
-
Returns application 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 Returns:
Field object- Type
- Object
-
<static> appObj.getFieldValueSync(fieldName) → {*}
-
Returns application 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 Returns:
Field value. Can be any JSON object.- Type
- *
-
<static> appObj.getGroupNames(callback)
-
Returns an array of all group names within the application
Parameters:
Name Type Description callback
function Callback with error and array of group names. -
<static> appObj.getOption(optionName) → {*}
-
Gets individual option value. Will first check if option is defined for the application, else it will revert to the global level option.
Parameters:
Name Type Description optionName
String Option name Returns:
Option value (can be any JSON type)- Type
- *
-
<static> appObj.getRoomNames(callback)
-
Returns an array of all room names within the application.
Parameters:
Name Type Description callback
function Callback with error and array of room names. -
<static> appObj.getRoomOccupantCount(roomName, callback)
-
Counts how many occupants are in a room.
Parameters:
Name Type Description roomName
string Room name which uniquely identifies a room within an EasyRTC application. callback
function Callback with error and client count -
<static> appObj.group(groupName, callback)
-
NOT YET IMPLEMENTED - Gets group object for a given group name. Returns null if group not found. The returned group object includes functions for managing group fields.
Parameters:
Name Type Description groupName
string Group name callback
function Callback with error and object containing EasyRTC group object. -
<static> appObj.isConnected(easyrtcid, callback)
-
Gets connection status for a connection. It is possible for a connection to be considered connected without being authenticated.
Parameters:
Name Type Description easyrtcid
string EasyRTC unique identifier for a socket connection. callback
function Callback with error and a boolean indicating if easyrtcid is connected. -
<static> appObj.isConnectedSync(easyrtcid) → {boolean}
-
Gets connection status for a connection. It is possible for a connection to be considered connected without being authenticated. Synchronous function.
Parameters:
Name Type Description easyrtcid
string EasyRTC unique identifier for a socket connection. Returns:
- Type
- boolean
-
<static> appObj.isRoom(roomName, callback)
-
Checks if a provided room is defined. The callback returns a boolean if room is defined.
Parameters:
Name Type Description roomName
string Room name which uniquely identifies a room within an EasyRTC application. callback
function Callback with error and boolean of whether room is defined. -
<static> appObj.isRoomSync(roomName) → {Boolean}
-
Checks if a provided room is defined. This is a synchronous function, thus may not be available in custom cases where room state is not kept in memory.
Parameters:
Name Type Description roomName
string Room name which uniquely identifies a room within an EasyRTC application. Returns:
Returns boolean. True if room is defined.- Type
- Boolean
-
<static> appObj.isSession(easyrtcsid, callback)
-
Checks if a provided session is defined. The callback returns a boolean if session is defined
Parameters:
Name Type Description easyrtcsid
string EasyRTC session identifier callback
function Callback with error and boolean of whether session is defined. -
<static> appObj.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 room object. -
<static> appObj.session(easyrtcsid, callback)
-
NOT YET IMPLEMENTED - Gets session object for a given easyrtcsid. Returns null if session not found. The returned session object includes functions for managing session fields.
Parameters:
Name Type Description easyrtcsid
string EasyRTC session identifier callback
function Callback with error and object containing EasyRTC session object. -
<static> appObj.setField(fieldName, fieldValue, fieldOption, next)
-
Sets application field value for a given field name.
Parameters:
Name Type Argument 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). -
<static> appObj.setOption(optionName, optionValue) → {Boolean}
-
Sets individual option. Set value to NULL to delete the option (thus reverting to global option).
Parameters:
Name Type Argument Description optionName
String Option name optionValue
* <nullable>
Option value Returns:
true on success, false on failure- Type
- Boolean