Options
All
  • Public
  • Public/Protected
  • All
Menu

Class RoomServer

A class to represent the room server.

Hierarchy

  • RoomServer

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

msgHandlers

msgHandlers: Record<string, function[]>

Handlers for message from the room server.

ws

ws: WebSocket

Websocket that represent the room server.

Methods

emit

  • emit(id: string, msg: any): void
  • Emits a message to the room server.

    Parameters

    • id: string

      Type of message.

    • msg: any

      Message to send.

    Returns void

Private keepAlive

  • keepAlive(): void

onMsg

  • onMsg(message: string): void
  • Dispatchs messages received from the room server to the corresponding handlers.

    Parameters

    • message: string

    Returns void

    msg

register

  • register(msgId: string, f: function): void
  • Registers a handler for a type of message from the room server.

    Parameters

    • msgId: string

      Type of message.

    • f: function

      Handler.

        • (data: any): void
        • Parameters

          • data: any

          Returns void

    Returns void

Generated using TypeDoc