Builder for websockets.

Constructors

Accessors

  • get buffer(): | undefined
    | WebsocketBuffer<
        string
        | ArrayBufferLike
        | ArrayBufferView<ArrayBufferLike>
        | Blob,
    >

    Getter for the buffer.

    Returns
        | undefined
        | WebsocketBuffer<
            string
            | ArrayBufferLike
            | ArrayBufferView<ArrayBufferLike>
            | Blob,
        >

    the buffer, undefined if no buffer has been set

  • get instantReconnect(): undefined | boolean

    Getter for wether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.

    Returns undefined | boolean

    wether to reconnect immediately after a connection has been lost, undefined if no value has been set

  • get maxRetries(): undefined | number

    Getter for the maximum number of retries before giving up.

    Returns undefined | number

    the maximum number of retries before giving up, undefined if no maximum has been set

  • get protocols(): undefined | string | string[]

    Getter for the protocols.

    Returns undefined | string | string[]

    the protocols, undefined if no protocols have been set

Methods

  • Adds a buffer to the websocket. Subsequent calls to this method will override the previously set buffer.

    Parameters

    • buffer:
          | undefined
          | WebsocketBuffer<
              string
              | ArrayBufferLike
              | ArrayBufferView<ArrayBufferLike>
              | Blob,
          >

      the buffer to add

    Returns WebsocketBuilder

  • Sets wether to reconnect immediately after a connection has been lost, ignoring the backoff strategy for the first retry.

    Parameters

    • instantReconnect: undefined | boolean

      wether to reconnect immediately after a connection has been lost

    Returns WebsocketBuilder

  • Sets the maximum number of retries before giving up. No limit if undefined.

    Parameters

    • maxRetries: undefined | number

      the maximum number of retries before giving up

    Returns WebsocketBuilder

  • Adds protocols to the websocket. Subsequent calls to this method will override the previously set protocols.

    Parameters

    • protocols: undefined | string | string[]

      the protocols to add

    Returns WebsocketBuilder