Options
All
  • Public
  • Public/Protected
  • All
Menu

Used to abstract implementation details to allow for NodeJS and Browser usage of the library.

WebSocket Clover Interface. Abstracts the WebSocket implementation so that the library is not tied to a Browser implementation.

Interface to connect a websocket implementation to.

see

https://developer.mozilla.org/en-US/docs/Web/API/WebSocket or https://html.spec.whatwg.org/multipage/web-sockets.html

Hierarchy

Index

Constructors

constructor

Properties

Private endpoint

endpoint: string

Private listeners

listeners: Array<WebSocketListener>

Private logger

logger: Logger = Logger.create()

Private webSocket

webSocket: any

Methods

addListener

connect

createWebSocket

  • createWebSocket(endpoint: string): any
  • For JS impls, we need to abstract out the WebSocket so that the library can be used in browsers and non-browsers.

    This MUST return immediately! It cannot use any type of promise or deferral, or the listener will not be properly attached before events begin firing.

    Parameters

    • endpoint: string

      the uri to connect to

    Returns any

getBufferedAmount

  • getBufferedAmount(): number

getListeners

getProtocol

  • getProtocol(): string

getReadyState

getState

getUrl

  • getUrl(): String

isOpen

  • isOpen(): boolean

Private notifyOnClose

  • notifyOnClose(event: CloseEvent): void

Private notifyOnError

  • notifyOnError(event: any): void

Private notifyOnMessage

  • notifyOnMessage(event: MessageEvent): void

Private notifyOnOpen

  • notifyOnOpen(event: Event): void

removeListener

sendClose

sendPing

sendPong

sendText

Generated using TypeDoc