Class: RoomSystem

RoomSystem(appConstructor)

RoomSystem class, manages multiple rooms, and passes incoming data to correct room.

Constructor

new RoomSystem(appConstructor)

Create new RoomSystem instance.

Parameters:
Name Type Description
appConstructor function

App constructor. Keep in mind, custom app must implement onConnect, and recieveData methods.

Source:

Members

appConstructor

Properties:
Name Type Description
appConstructor function

App constructor. Should implement onConnect, and recieveData methods.

Source:

rooms

Properties:
Name Type Description
rooms Array.<Room>

Array of all rooms in a room system.

Source:

Methods

createRoom(socket, maxMembers) → {Status}

Creates and adds a new room to this room system. Makes a socket that made, the request a room leader.

Parameters:
Name Type Default Description
socket Object

Founding socket.io socket.

maxMembers number 2

Maximum room size.

Source:
Returns:

Status message, with {string} created room id as a data.

Type
Status

getRoom(roomId) → {Room|null}

Finds and returns room with matching room id or null if it doesn't exist'.

Parameters:
Name Type Description
roomId srting
Source:
Returns:
Type
Room | null

leaveRoom()

Not implemented.

Source: