Options
All
  • Public
  • Public/Protected
  • All
Menu

web socket class for auto summary

Hierarchy

Index

Constructors

Properties

IsSubscribeDummyResponse: boolean = true
WS_INTERVAL_HEARTBEAT: number = 10000
auth: CXoneAuth = CXoneAuth.instance
autoSummaryInput: { contactId: string; subscriptions: string[]; webSocketUri: string } = ...

Type declaration

  • contactId: string
  • subscriptions: string[]
  • webSocketUri: string
connectionId: string = ''
contactId: string = '0'
hearbeatSubscription: Subscription
hearbeatTimer: Observable<number>
logger: Logger = ...
onAutoSummaryReceived: Subject<AutoSummaryBroadcastData> = ...

used to send emitted websocket events data.

subscriptions: string[] = []
websocketUri: string = ''
wssWorker: any

Methods

  • example
    attemptReconnect({reconnectInterval: 300, reconnectAttempts:4});
    

    Parameters

    • reconnectInfo: WsReconnectInfo

      reconnectIntervalInMs in millisecond, maxReconnectAttempts in number and ws url

    • Optional wsWorker: any

    Returns void

  • attemptToReconnect(): void
  • Use to attempt to reconnect to the web socket worker

    example
    this.attemptToReconnect();
    

    Returns void

  • broadcastAutoSummary(message: any): void
  • used to broadcast the message to other tabs.

    example
    • broadcastAutoSummary();

    Parameters

    • message: any

      message to broadcast

    Returns void

  • close(): void
  • used to unsubscribe events and clear props.

    example
    • close()

    Returns void

  • connect(websocketServerUri: string): boolean
  • used to connect to the socket.

    example
    • connect();

    Parameters

    • websocketServerUri: string

      websocketServer uri

    Returns boolean

  • disconnectWebsocket(): void
  • used to unsubscribe and disconnect to socket events.

    example
    • disconnectWebsocket();

    Returns void

  • initWebSocketWorker(): void
  • Use to initializing the web socket worker and will return the method inside the worker

    example
    this.initWebSocketWorker();
    

    Returns void

  • onClosed(): void
  • onError(): void
  • onMessage(responseMessage: any): void
  • callback for when message received

    example
    • onMessage(msg);

    Parameters

    • responseMessage: any

    Returns void

  • onOpen(): void
  • Callback method when a connection is open and ready to send and receive data

    example
    • onOpen()

    Returns void

  • onReconnect(_msg: any): void
  • Callback method when a ws reconnect attempts in progress

    example
    • this.onReconnect()

    Parameters

    • _msg: any

    Returns void

  • onReconnectComplete(): void
  • onReconnectSuccess(): void
  • reconnectWebsocket(): void
  • used to Reconnect to the socket.

    example
    • reConnectToSocket();

    Returns void

  • sendHeartbeat(): void
  • used to send heart beat to socket.

    example
    • sendHeartbeat();

    Returns void

  • sendMessage(msg: unknown, wsWorker: any): void
  • Method to send to websocket worker

    example
    sendMessage('hi');
    

    Parameters

    • msg: unknown

      message send to websocket

    • wsWorker: any

    Returns void

  • subscribe(autoSummaryInput: { contactId: string; subscriptions: string[]; webSocketUri: string }): void
  • Used to open the webSocket data and subscribe to it.

    example
    subscribe();
    @param webSocketUri - webSocketUri for auto summary
    @param contactId - contactId for auto summary
    @param subscriptions - subscriptions for auto summary

    Parameters

    • autoSummaryInput: { contactId: string; subscriptions: string[]; webSocketUri: string }
      • contactId: string
      • subscriptions: string[]
      • webSocketUri: string

    Returns void

  • subscribeToSocket(topic: string): boolean
  • used to subscribe to socket events.

    example
    • subscribeToSocket('');

    Parameters

    • topic: string

      topic to subscribe

    Returns boolean

  • terminateWebSocketWorker(): void
  • Use to terminate the web socket worker

    example
    this.terminateWebSocketWorker();
    

    Returns void

Generated using TypeDoc