This class is a wrapper for web sockets, that allows to receive messages with async / await instead of using callbacks (onmessage onopen ...)

It also has a on('message') event, because sometimes you just need it. When you solely use the event based interface, and don't use the waitForMessage functions, then you need to set disableWaitForMessage to true, because otherwise you will get an error that you didn't collect incoming messages with waitFor... functions.

Hierarchy (view full)

Constructors

Properties

name: string
webSocket: null | WebSocket

Methods

  • Releases the websocket from this class.

    All handlers are de-registered, the rest is left as-is.

    Attention: If messages arrive in the meantime they might get lost. Usually it is better to pass around the WebSocketPromiseBased instance, because it buffers messages that arrive in the time until new handlers are registered.

    Returns WebSocket