Class WebSocketClient

You must provide an error handler addEventListener('error'). Otherwise, errors will just be ignored.

Events:

Hierarchy

  • CreateDestroy
    • WebSocketClient

Properties

[initLock]: RWLockWriter
_closed: boolean = false
address: string
closedP: Promise<void>

Resolved when the underlying server is closed.

The connection of the client.

connectionMap: WebSocketConnectionMap = ...

Map of connections with connectionId keys that correspond to WebSocketConnection values.

logger: Logger
resolveClosedP: (() => void)

Type declaration

    • (): void
    • Returns void

Accessors

  • get [destroyed](): boolean
  • Returns boolean

  • get [eventHandled](): ReadonlyWeakSet<Event>
  • Returns ReadonlyWeakSet<Event>

  • get [eventHandlers](): ReadonlyMap<string, Set<EventHandlerInfo>>
  • Returns ReadonlyMap<string, Set<EventHandlerInfo>>

  • get [eventTarget](): EventTarget
  • Returns EventTarget

  • get [handleEventError](): ((evt: EventError) => void)
  • Returns ((evt: EventError) => void)

      • (evt: EventError): void
      • Parameters

        • evt: EventError

        Returns void

  • get [statusP](): Promise<Status>
  • Returns Promise<Status>

  • get [status](): Status
  • Returns Status

  • get closed(): boolean
  • Boolean that indicates whether the internal server is closed or not.

    Returns boolean

Methods

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | AddEventListenerOptions

    Returns void

  • Destroys WebSocketClient

    Parameters

    • opts: {
          errorCode?: number;
          errorMessage?: string;
          force?: boolean;
      } = {}
      • Optional errorCode?: number

        The error code to send to connections on closing

      • Optional errorMessage?: string

        The error message to send to connections on closing

      • Optional force?: boolean

        When force is false, the returned promise will wait for all streams and connections to close naturally before resolving.

    Returns Promise<void>

  • Parameters

    • event: Event

    Returns boolean

  • Parameters

    • evt: EventAll<Event>

    Returns void

  • Parameters

    • type: string
    • callback: null | EventListenerOrEventListenerObject
    • Optional options: boolean | EventListenerOptions

    Returns void

Generated using TypeDoc