Room Class
A room containing and conencting Guest
s. Can be created by a Hotel
or used alone.
Constructor
Room
(
-
name
Parameters:
-
name
String
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:
-
msg
ObjectThe message
-
sender
StringThe id of the sender of the message (who will be skipped)
create_guest
(
Guest
-
conn
Create a guest which might join the room
Parameters:
-
conn
ChannelThe connection to the guest
Returns:
join
(
Boolean
private
-
guets
A guest joins the room. Will be removed when it emits 'left'
Parameters:
-
guets
GuestThe 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:
-
msg
ObjectThe message
-
recipient
StringThe 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