ServerRoom

ServerRoom

(private) new ServerRoom(name)

Source:
Properties:
Name Type Description
name string

Line room class.

Parameters:
Name Type Description
name string

Room name

Methods

add(connection)

Source:

Adds a connection into room.

Parameters:
Name Type Description
connection ServerConnection

broadcast(name, payloadopt)

Source:

Broadcast a message to all connections in the room.

Parameters:
Name Type Attributes Description
name string
payload any <optional>

getConnectionById(connectionId) → (nullable) {ServerConnection}

Source:

Gets a connection by id.

Parameters:
Name Type Description
connectionId string
Returns:
Type
ServerConnection

getConnections() → {Object}

Source:

Gets all connections in the room. Returns a object where keys are connection id and values are ServerConnection.

Returns:
Type
Object

getConnectionsCount() → {number}

Source:

Returns the total connection count in room.

Returns:
Type
number

remove(connection) → {boolean}

Source:

Removes a connection from room.

Parameters:
Name Type Description
connection ServerConnection
Returns:
Type
boolean