Options
All
  • Public
  • Public/Protected
  • All
Menu

web socket class for agent assist

Hierarchy

Index

Constructors

Properties

WS_INTERVAL_HEARTBEAT: number = 10000
agentAssistProcessorService: AgentAssistProcessorService = ...
connectionId: string = ''
hearbeatSubscription: Subscription
hearbeatTimer: Observable<number>
isWSConnected: boolean = false
logger: Logger
onMessageNotification: Subject<AgentAssistBaseResponse> = ...
serviceName: string = 'agent-assist'
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

  • attemptToReSubscribe(): void
  • Use to attempt to reconnect and resubscribe active topics to the web socket worker

    example
    this.attemptToReSubscribe();
    

    Returns void

  • broadcastWSMessage(message: any): void
  • used to broadcast the acp messages to other tabs.

    example
    this.broadcastWSMessage(message);
    

    Parameters

    • message: any

      message to broadcast

    Returns void

  • close(wsWorker?: any): void
  • This function used to close connection with websocket server

    example
    close();
    

    Parameters

    • Optional wsWorker: any

    Returns void

  • closeWebsocket(): void
  • Use to close the web socket

    example
    this.closeWebsocket();
    

    Returns void

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

    example
    this.connect('ws://localhost:8080');
    

    Parameters

    • websocketServerUri: string

      websocketServer uri

    Returns void

  • generate topic for WebSocket for given provider ws input

    example
    const topic = this.generateTopicForProvider(agentAssistWSInput);
    

    Parameters

    Returns string

  • initLogger(className: string): void
  • Use to initializing the logger

    example
    this.initLogger('agent-assist');
    

    Parameters

    • className: string

      name of class for logger

    Returns void

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

    example
    this.initWebSocketWorker();
    

    Parameters

    • workerName: string

    Returns void

  • loadFeatureToggles(): Promise<void>
  • load feature toggles with Feature toggle service

    example
    this.loadFeatureToggles();
    

    Returns Promise<void>

  • onClosed(): void
  • onError(): void
  • onMessage(message: any): void
  • on websocket message received

    example
    • this.onMessage(message);

    Parameters

    • message: any

      message

    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
  • method to parse the response

    example
    this.parse(response);
    

    Parameters

    • response: any

      response

    Returns AgentAssistBaseResponse

  • registerAgentAssistGetNextSubject(): Promise<void>
  • used to register subscription to the agentAssistGetNextEventSubject for getting the AgentAssist getnext event

    example
    this.registerAgentAssistGetNextSubject();
    

    Returns Promise<void>

  • registerWebSocketCloseRequest(): Promise<void>
  • used to register subscription to the agentAssistWebSocketUnsubsribeSubject for unsubscribing topics for a contact Id

    example
    this.registerWebSocketCloseRequest();
    

    Returns Promise<void>

  • registerWebSocketConnectionRequest(): Promise<void>
  • used to register subscription to the agentAssistWSSubject for connect and subscribe to websocket

    example
    this.registerWebSocketConnectionRequest();
    

    Returns Promise<void>

  • registerWebSocketOnMessageNotification(): void
  • used to register subscription to the websocket onMessageNotification subject

    example
    this.registerWebSocketOnMessageNotification();
    

    Returns void

  • resubscribeAllActiveTopicsToWebSocket(): Promise<void>
  • used to unsubscribe and disconnect to socket events.

    example
    • unsubscribeAllActiveTopicsFromtWebsocket();

    Returns Promise<void>

  • sendHeartbeat(): void
  • used to send heart beat to websocket

    example
    this.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 to websocket topic

    example
    this.subscribe('topic');
    

    Parameters

    Returns boolean

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

    example
    this.terminateWebSocketWorker();
    

    Returns void

  • unsubscribeFromWebSocketForContactId(contactId: string, getNextDataForContactId: AgentAssistWSRequest[]): void
  • unsubscribe from websocket for a contact Id

    example
    this.unsubscribeFromWebSocketForContactId(contactId);
    

    Parameters

    • contactId: string

      contact Id

    • getNextDataForContactId: AgentAssistWSRequest[]

      get next data for contact Id

    Returns void

Generated using TypeDoc