Class: Room

Room


new Room(room_token, client, onOpen)

Room object

Parameters:
Name Type Description
room_token string

unique string/hash for room

client Client

client who is openning room

onOpen function

callback when room is ready

Members


room_token :string

room token

Type:
  • string

clients :Array.<Clients>

List of clients in room

Type:
  • Array.<Clients>

sketch :sketch

Active sketch in room

Type:
  • sketch

Methods


sendBroadcastRAW(msg)

Sends text message to all clients in room

Parameters:
Name Type Description
msg string

text message


sendBroadcastObj(obj)

Sends object as JSON to all clients in room

Parameters:
Name Type Description
obj object

object message


sendBroadcastRAWExclude(msg, clientExcluded)

Sends text message to all clients in room exept excluded client

Parameters:
Name Type Description
msg string

text message

clientExcluded Client

client that will be excluded


sendBroadcastObjExclude(msg, clientExcluded)

Sends object as JSON to all clients in room exept excluded client

Parameters:
Name Type Description
msg string

text message

clientExcluded Client

client that will be excluded


removeUser(client)

Removes client from room

Parameters:
Name Type Description
client Client

A client that will be removed from the room


addUser(client)

Add client to room

Parameters:
Name Type Description
client Client

A client that will be added to the room


destructor()

Room destructor that will be called when all clients leave the room