Constructor
new JsonMessagesProtocol(namedAs)
Arguments:
-
namedAs
(String)
 The name of a resulting protocol
Extends
Methods
broadcast(command, params)
Send specified command to all user sessions connected using this protocol
Arguments:
-
command
(String)
 Command to send
-
params
(*)
 Any value
getUserSessions(userID) → Array.<Number>
Returns the IDs of all the sessions with established WebSocket connections
Arguments:
-
userID
(Number)
 User identifier (from uba_user)
sendCommand(command, recipient, params) → Boolean
Send specified command to recipient. Return true
if data has been successfully sent (no guaranty it is received by client)
Arguments:
-
command
(String)
 Command to send
-
recipient
(Number)
 User Session identifier
-
params
(*)
 Any value
command
(String)
 Command to send
params
(*)
 Any value
userID
(Number)
 User identifier (from uba_user)
true
if data has been successfully sent (no guaranty it is received by client)
command
(String)
 Command to send
recipient
(Number)
 User Session identifier
params
(*)
 Any value