Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Broadcaster

Broadcaster

Handles the broadcast of every WS messages

class

Broadcaster

Hierarchy

  • Broadcaster

Index

Constructors

constructor

Properties

Protected _listerners

_listerners: any[] = []

our message listeners

Protected _state

_state: State

Protected _ws

_ws: WebSocketConnection

the WebSocket connection

Protected member

member: any

Static Protected _instance

_instance: Broadcaster = new Broadcaster()

the singleton Broadcaster

Methods

addListener

  • addListener(messageType: any, callback: any, content?: any): number
  • Adds a listener to get ws messages

    Parameters

    • messageType: any

      the type of message to subscribe to

    • callback: any

      the function to call on hit

    • Default value content: any = null

      the data to filter by

    Returns number

    the id of the newly created listener

broadCastMessage

  • broadCastMessage(msg: any, raw?: boolean): void
  • Broadcasts a message to the ws connection

    throws

    Error on no ws connection.

    Parameters

    • msg: any

      the message to send.

    • Default value raw: boolean = false

      send as raw data or stringified. defaults to stringified

    Returns void

getMember

  • getMember(): any

getState

Private handleMessages

  • handleMessages(message: any): void

removeListener

  • removeListener(listenerId: number): void

setBot

  • setBot(botM: any): void

setWs

  • setWs(ws: WebSocketConnection, state: State): void

Private testObjects

  • testObjects(obj1: any, obj2: any): boolean

Static getInstance

Generated using TypeDoc