new eventListener()
Event listeners used by EasyRTC. Many of these can be overridden using server options. The interfaces should be used as a guide for creating new listeners.
- Source:
- easyrtc_default_event_listeners.js, line 24
Methods
-
<static> onAuthenticate(socket, easyrtcid, appName, username, credential, easyrtcAuthMessage, next)
-
Default listener for event "authenticate". This event is called as part of the authentication process. To deny authentication, call the next() with an Error. By default everyone gets in!
Parameters:
Name Type Argument Description socketObject Socket.io socket object. References the individual connection socket. easyrtcidString Unique identifier for an EasyRTC connection. appNamestring Application name which uniquely identifies it on the server. usernameString <nullable>
Username to assign to the connection. credential* <nullable>
Credential for the connection. Can be any JSONable object. easyrtcAuthMessageObject Message object containing the complete authentication message sent by the connection. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 37
-
<static> onAuthenticated(connectionObj, next)
-
Default listener for event "authenticated". This event is called after a connection is authenticated and the connection object is generated and requested rooms are joined. Call next(err) to continue the connection procedure.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 48
-
<static> onConnection(socket, easyrtcid, next)
-
Default listener for event "connection". This event is called when socket.io accepts a new connection.
Parameters:
Name Type Description socketObject Socket.io socket object. References the individual connection socket. easyrtcidString Unique identifier for an EasyRTC connection. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 60
-
<static> onDisconnect(connectionObj, next)
-
Default listener for event "disconnect". This event is called when socket.io detects a disconnection. Disconnections can occur due to either side purposefully dropping a connection, network disconnection, or time out.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 86
-
<static> onEasyrtcAuth(socket, easyrtcid, msg, socketCallback, callback)
-
Default listener for event "easyrtcAuth". This event is fired when an incoming 'easyrtcAuth' message is received from a client.
Parameters:
Name Type Description socketObject Socket.io socket object. References the individual connection socket. easyrtcidString Unique identifier for an EasyRTC connection. msgObject Message object which contains the full message from a client; this can include the standard msgType and msgData fields. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). callbackObject Callback to call upon completion. Delivers parameter (err, connectionObj). - Source:
- easyrtc_default_event_listeners.js, line 127
-
<static> onEasyrtcCmd(connectionObj, msg, socketCallback, next)
-
Default listener for event "easyrtcCmd". This event is fired when an incoming 'easyrtcCmd' message is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. msgObject Message object which contains the full message from a client; this can include the standard msgType and msgData fields. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 444
-
<static> onEasyrtcMsg(connectionObj, msg, socketCallback, next)
-
Default listener for event "easyrtcMsg". This event is fired when an incoming 'easyrtcMsg' message is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. msgObject Message object which contains the full message from a client; this can include the standard msgType and msgData fields. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 551
-
<static> onEmitEasyrtcCmd(connectionObj, msgType, msg, socketCallback, next)
-
Default listener for event "emitEasyrtcCmd". This event is fired when the server should emit an EasyRTC command to a client. The easyrtcid and serverTime fields will be added to the msg automatically.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. msgTypeString Message type of the message. msgObject Message object which contains the full message to a client; this can include the standard msgData field. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 799
-
<static> onEmitEasyrtcMsg(connectionObj, msgType, msg, socketCallback, next)
-
Default listener for event "emitEasyrtcMsg". This event is fired when the server should emit an EasyRTC message to a client. The easyrtcid and serverTime fields will be added to the msg automatically.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. msgTypeString Message type of the message. msgObject Message object which contains the full message to a client; this can include the standard msgData field. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 830
-
<static> onEmitError(connectionObj, errorCode, socketCallback, next)
-
Default listener for event "emitError". This event is fired when the server should emit an EasyRTC error to a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. errorCodeString EasyRTC error code associated with an error. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 859
-
<static> onEmitReturnAck(connectionObj, socketCallback, next)
-
Default listener for event "emitReturnAck". This event is fired when the server should return an Ack to a client via an acknowledgment message.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 881
-
<static> onEmitReturnError(connectionObj, socketCallback, errorCode, next)
-
Default listener for event "emitReturnError". This event is fired when the server should return an Error to a client via an acknowledgment message.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). errorCodeString EasyRTC error code associated with an error. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 910
-
<static> onEmitReturnToken(connectionObj, socketCallback, next)
-
Default listener for event "emitReturnToken". This event is fired when the server should return a token to a client via an acknowledgment message. This is done after a client has been authenticated and the connection has been established.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 939
-
<static> onGetIceConfig(connectionObj, callback)
-
Default listener for event "getIceConfig". Returns an ICE configuration object to the callback. The ICE configuration object will hold the array of STUN and TURN servers the connection should use when forming a peer connection. This default listener uses the "appIceServers" configuration option at the application level.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. callbackFunction Callback of form (err, iceConfigArray) - Source:
- easyrtc_default_event_listeners.js, line 1373
-
<static> onLog(level, logText, logFields, next)
-
Default listener for event "log". This event is fired when ever a loggable item is observed.
Parameters:
Name Type Argument Description levelstring Log severity level. Can be ("debug"|"info"|"warning"|"error") logTextstring Text for log. logFields* <optional>
<nullable>
Simple JSON object which contains extra fields to be logged. nextnextCallback <nullable>
A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1043
-
<static> onMsgTypeGetIceConfig(connectionObj, socketCallback, next)
-
Default listener for event "msgTypeGetIceConfig". This event is fired when an easyrtcCmd message with msgType of "getIceConfig" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1220
-
<static> onMsgTypeGetRoomList(connectionObj, socketCallback, next)
-
Default listener for event "msgTypeGetRoomList". This event is fired when an easyrtcCmd message with msgType of "getRoomList" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1250
-
<static> onMsgTypeRoomJoin(connectionObj, rooms, socketCallback, next)
-
Default listener for event "msgTypeRoomJoin". This event is fired when an easyrtcCmd message with msgType of "roomJoin" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. roomsObject A room object containing a map of room names. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1108
-
<static> onMsgTypeRoomLeave(connectionObj, rooms, socketCallback, next)
-
Default listener for event "msgTypeRoomLeave". This event is fired when an easyrtcCmd message with msgType of "roomLeave" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. roomsObject A room object containing a map of room names. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1180
-
<static> onMsgTypeSetPresence(connectionObj, presenceObj, socketCallback, next)
-
Default listener for event "msgTypeSetPresence". This event is fired when an easyrtcCmd message with msgType of "setPresence" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. presenceObjObject Presence object which contains all the fields for setting a presence for a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1284
-
<static> onMsgTypeSetRoomApiField(connectionObj, roomApiFieldObj, socketCallback, next)
-
Default listener for event "msgTypeSetRoomApiField". This event is fired when an easyrtcCmd message with msgType of "setRoomApiField" is received from a client.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. roomApiFieldObjObject Api Field object which contains all the fields for setting a presence for a connection. socketCallbackObject Socket.io callback function which delivers a response to a socket. Expects a single parameter (msg). nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1328
-
<static> onRoomCreate(appObj, creatorConnectionObj, roomName, roomOptions, next)
-
Default listener for event "roomCreate". Creates a room attached to an application with a specified room name. The optional creatorConnectionObj is provided to provide context; joining the room is done separately. If successful, the callback returns a roomObj.
Parameters:
Name Type Argument Description appObjObject EasyRTC application object. Contains methods used for identifying and managing an application. creatorConnectionObjObject <nullable>
EasyRTC connection object belonging to the creator of the room. Contains methods used for identifying and managing a connection. roomNamestring Room name which uniquely identifies a room within an EasyRTC application. roomOptionsObject <nullable>
Room options. May be null. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1388
-
<static> onRoomJoin(connectionObj, roomName, callback)
-
Default listener for event "roomJoin". Joins a connection to a a specified room. If successful, the callback will return a connectionRoomObj.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. roomNamestring Room name which uniquely identifies a room within an EasyRTC application. callbackFunction Callback of form (err, connectionRoomObj) - Source:
- easyrtc_default_event_listeners.js, line 1401
-
<static> onRoomLeave(connectionObj, roomName, next)
-
Default listener for event "roomLeave". Run upon a connection leaving a room.
Parameters:
Name Type Description connectionObjObject EasyRTC connection object. Contains methods used for identifying and managing a connection. roomNamestring Room name which uniquely identifies a room within an EasyRTC application. nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1423
-
<static> onShutdown(next)
-
Default listener for event "shutdown". This event is fired when the server is being shutdown.
Parameters:
Name Type Description nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1448
-
<static> onStartup(next)
-
Default listener for event "startup". This event initializes EasyRTC server so it is ready for connections.
Parameters:
Name Type Description nextnextCallback A success callback of form next(err). - Source:
- easyrtc_default_event_listeners.js, line 1459