Methods
addToRoom(socket, roomId)
- Source:
Add a socket to a room
Parameters:
Name | Type | Description |
---|---|---|
socket |
server.Socket | Socket to add to the room. |
roomId |
String | Id of the room |
broadcast(roomsIds, excludeSocket, channel, …args)
- Source:
Send a string message to all client of given room(s). If no room not specified, the message is sent to all clients
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomsIds |
String | Array | Ids of the rooms that must receive the message. If null the message is sent to all clients |
|
excludeSocket |
server.Socket | Optionnal socket to ignore when broadcasting the message, typically the client at the origin of the message |
|
channel |
String | Channel of the message |
|
args |
* |
<repeatable> |
Arguments of the message (as many as needed, of any type) |
broadcastBinary(roomsIds, excludeSocket, channel, …args)
- Source:
Send a binary message (TypedArray) to all client of given room(s). If no room not specified, the message is sent to all clients
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
roomsIds |
String | Array | Ids of the rooms that must receive the message. If null the message is sent to all clients |
|
excludeSocket |
server.Socket | Optionnal socket to ignore when broadcasting the message, typically the client at the origin of the message |
|
channel |
String | Channel of the message |
|
args |
* |
<repeatable> |
Arguments of the message (as many as needed, of any type) |
removeFromRoom(socket, roomIdopt)
- Source:
Remove a socket from a room
Parameters:
Name | Type | Attributes | Default | Description |
---|---|---|---|---|
socket |
server.Socket | Socket to remove from the room. |
||
roomId |
String |
<optional> |
null
|
Id of the room |