API Docs for:
Show:

Room Class

Extends events.EventEmitter
Module: easy-signaling

A room containing and conencting Guests. 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

Properties

Methods

broadcast

(
  • msg
  • sender
)
private

Send a message to all guest except the sender

Parameters:

  • msg Object

    The message

  • sender String

    The id of the sender of the message (who will be skipped)

create_guest

(
  • conn
)
Guest

Create a guest which might join the room

Parameters:

  • conn Channel

    The connection to the guest

Returns:

join

(
  • guets
)
Boolean private

A guest joins the room. Will be removed when it emits 'left'

Parameters:

  • guets Guest

    The guest which joins the room

Returns:

Boolean:

true if and only if the guest could join

send

(
  • msg
  • recipient
)
Boolean private

Send a message to a guest

Parameters:

  • msg Object

    The message

  • recipient String

    The 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

Events

empty

()

The room was left by all guests

guest_joined

(
  • guest
)

A guest joined the room

Parameters:

  • guest Guest

    The new guest

guest_left

(
  • guest
)

A guest left the room

Parameters:

  • guest Guest

    The leaving guest