Class WebSocketClient

Websocket client

Hierarchy

  • WebSocketClient

Constructors

Properties

_connection: null | WebSocketClient = null
brandId: BrandId
channelId: ChannelId
onError: undefined | ((error) => void)

Type declaration

    • (error): void
    • Parameters

      • error: Error

      Returns void

options: WebSocketClientOptions
visitorId: VisitorId

Methods

  • Handle error from event listeners with onError callback or throw error

    Parameters

    • event: CustomEvent<Event | ErrorEvent | CloseEvent>

    Returns void

  • Connect websocket

    Returns void

  • Disconnect websocket

    Returns void

  • Unregister event handler to websocket event

    Parameters

    • eventType: WebSocketClientEvent

      websocket event

    • handlerCallback: ((event) => void)

      event handler

        • (event): void
        • Parameters

          • event: CustomEvent<any>

          Returns void

    Returns void

  • Register event handler to websocket event

    Parameters

    • eventType: WebSocketClientEvent

      websocket event

    • handlerCallback: ((event) => void)

      event handler

        • (event): void
        • Parameters

          • event: CustomEvent<any>

          Returns void

    Returns void

  • Reconnect websocket

    Returns void

  • Send data to active connection

    Parameters

    • data: unknown

      data to send

    Returns void

Generated using TypeDoc