Class: appObj

appObj

new appObj()

The primary method for interfacing with an EasyRTC application.
Source:

Classes

connectionObj
roomObj
sessionObj

Members

(static) appObj.events

Expose all event functions
Source:

(static) appObj.util

Expose all utility functions
Source:

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.
Source:

(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))
Source:

(static) appObj.createRoom(roomName, optionsnullable, callback)

Creates a new room, sending the resulting room object to a provided callback.
Parameters:
Name Type Attributes 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))
Source:

(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))
Source:

(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.
Source:

(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.
Source:
Returns:
The application name.
Type
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.
Source:

(static) appObj.getConnectionCountSync() → {Number}

Sends the count of the number of connections in the app to a provided callback.
Source:
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.
Source:

(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.
Source:

(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)
Source:

(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.
Source:

(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
Source:
Returns:
Field object
Type
Object

(static) appObj.getFieldValueSync(fieldName) → (nullable) {*}

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
Source:
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.
Source:

(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
Source:
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.
Source:

(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
Source:

(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.
Source:

(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.
Source:

(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.
Source:
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.
Source:

(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.
Source:
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.
Source:

(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.
Source:

(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.
Source:

(static) appObj.setField(fieldName, fieldValue, fieldOptionnullable, nextopt)

Sets application 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).
Source:

(static) appObj.setOption(optionName, optionValuenullable) → {Boolean}

Sets individual option. Set value to NULL to delete the option (thus reverting to global option).
Parameters:
Name Type Attributes Description
optionName String Option name
optionValue * <nullable>
Option value
Source:
Returns:
true on success, false on failure
Type
Boolean