API Docs for:
Show:

Hotel Class

Extends events.EventEmitter
Module: easy-signaling

Manages Rooms and its Guests

Constructor

Hotel

()

Example:

var hotel = new Hotel()
guest_a = hotel.create_guest(conn_a, 'room')
guest_b = hotel.create_guest(conn_b, 'room')

Item Index

Properties

Methods

create_guest

(
  • conn
  • room_name
)
Guest

Create a new guest which might join the room with the given name

Parameters:

  • conn Channel

    The connection to the guest

  • room_name String

    The name of the room to join

Returns:

get_room

(
  • name
)
Room private

Get a room. The room is created if it did not exist. The room will be removed when it throws empty.

Parameters:

  • name String

    The name of the room

Returns:

Room:

Properties

rooms

Unknown private

An object containing the rooms with their names as keys

Events

room_created

(
  • room
)

A new room was created

Parameters:

  • room Room

    The new room

room_removed

(
  • room
)

A new room was removed because all guests left

Parameters:

  • room Room

    The empty room