new roomObj()
EasyRTC Room Object. Contains methods for handling a specific room including determining which connections have joined.
Members
-
<static> roomObj.events
-
Expose all event functions
-
<static> roomObj.util
-
Expose all utility functions
Methods
-
<static> roomObj.getApp() → {Object}
-
Returns the application object to which the room belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
Returns:
The application object- Type
- Object
-
<static> roomObj.getAppName() → {string}
-
Returns the application name for the application to which the room belongs. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
Returns:
The application name- Type
- string
-
<static> roomObj.getConnectionCount(callback)
-
Sends the count of the number of connections in a room to a provided callback.
Parameters:
Name Type Description callback
function Callback with error and array containing all easyrtcids. -
<static> roomObj.getConnectionCountSync() → {Number}
-
Sends the count of the number of connections in a room to a provided callback. Returns 0 if room doesn't exist.
Returns:
The current number of connections in a room.- Type
- Number
-
<static> roomObj.getConnectionObjects(callback)
-
Returns an array containing the connectionObjs of all connected clients within the room.
Parameters:
Name Type Description callback
function Callback with error and array containing connectionObjs. -
<static> roomObj.getConnections(callback)
-
Returns an array containing the easyrtcids of all connected clients within the room.
Parameters:
Name Type Description callback
function Callback with error and array containing all easyrtcids. -
<static> roomObj.getConnectionWithEasyrtcid(easyrtcid, callback)
-
Returns the connectionObj for a given easyrtcid, but only if it is currently a client in the room
Parameters:
Name Type Description easyrtcid
string EasyRTC unique identifier for a socket connection. callback
function Callback with error and connectionObj. -
<static> roomObj.getField(fieldName, callback)
-
Returns room 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> roomObj.getFields(limitToIsShared, callback)
-
Returns an object containing all field names and values within the room. 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> roomObj.getFieldSync(fieldName) → {Object}
-
Returns room level field object for a given field name. If the field is not set, it will return a field value 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> roomObj.getFieldValueSync(fieldName) → {*}
-
Returns room 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- Type
- *
-
<static> roomObj.getOption(optionName) → {*}
-
Gets individual option value. Will first check if option is defined for the room, else it will revert to the application level option (which will in turn fall back to the global level).
Parameters:
Name Type Description optionName
String Option name Returns:
Option value (can be any type)- Type
- *
-
<static> roomObj.getRoomName() → {string}
-
Returns the room name for the current room. Note that unlike most EasyRTC functions, this returns a value and does not use a callback.
Returns:
The room name- Type
- string
-
<static> roomObj.setField(fieldName, fieldValue, fieldOption, next)
-
Sets room 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). Possible err will be instanceof (ApplicationWarning). -
<static> roomObj.setOption(optionName, optionValue) → {Boolean}
-
Sets individual option which applies only to this room. Set value to NULL to delete the option (thus reverting to global option)
Parameters:
Name Type Description optionName
Object Option name optionValue
Object Option value Returns:
true on success, false on failure- Type
- Boolean