Room Class
A room containing and conencting Guests. Can be created by a Hotel or used alone.
Constructor
Room
(
-
name
Parameters:
-
nameString
Example:
var room = new Room()
guest_a = room.create_guest(conn_a)
guest_b = room.create_guest(conn_b)
Item Index
Methods
Events
Methods
broadcast
(
private
-
msg -
sender
Send a message to all guest except the sender
Parameters:
-
msgObjectThe message
-
senderStringThe id of the sender of the message (who will be skipped)
create_guest
(
Guest
-
conn
Create a guest which might join the room
Parameters:
-
connChannelThe connection to the guest
Returns:
join
(
Boolean
private
-
guets
A guest joins the room. Will be removed when it emits 'left'
Parameters:
-
guetsGuestThe guest which joins the room
Returns:
Boolean:
true if and only if the guest could join
send
(
Boolean
private
-
msg -
recipient
Send a message to a guest
Parameters:
-
msgObjectThe message
-
recipientStringThe recipient of the message
Returns:
Boolean:
True if the recipient exists
Properties
guests
Unknown
private
The current guests of the room
name
Unknown
The name of the room
