Global

Members


rooms :Array

List of active rooms

Type:
  • Array

connectionCounter :Number

counter of connection that was ever made to this server session

Type:
  • Number

Methods


loginHandler(data)

A method that handles the first message from the client. Responsible for authentication. Next decorates this connection object with all methods of a client and puts him into a room.

Parameters:
Name Type Description
data string

JSON encoded message


getRoom(room_token, client)

Creates and returns new room if room identified by room_token does not exist else returns existed room

Parameters:
Name Type Description
room_token string

Room token

client Client

Client who is opening room

Returns:
  • Room identified by room_token
Type
Room

newConnection(conn)

Decorate WebSocket client connection and use it as client of application.

Parameters:
Name Type Description
conn ws

WebSocket client connection