Options
All
  • Public
  • Public/Protected
  • All
Menu

digital web socket Class also implements websocket client abstract methods

Hierarchy

Index

Constructors

Properties

auth: CXoneAuth = CXoneAuth.instance
heartBeatTimer: Timer = undefined
internetCheckTimer: Timer = undefined
logger: CcfLogger = ...
maxReconnectAttempt: number = 10
onMessageReceived: Subject<any> = ...

used to send emitted websocket events data.

onWebSocketConnectionStatus: Subject<any> = ...

used for sending websocket connection status like success, error etc.

pendingPong: number = PENDING_PONG_DEFAULT_VALUE
retryIntervalInMs: number = 6000
wssWorker: any
cxoneDigitalWebsocket: CXoneDigitalWebsocket

Accessors

  • Method to create singleton object of the class

    example
    const cxoneDigitalWebsocket = CXoneDigitalWebsocket.instance;
    

    Returns CXoneDigitalWebsocket

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(retryOptions?: { maxRetryAttempts: number; retryIntervalInMs: number }): void
  • Use to attempt to reconnect to the web socket worker

    example
    this.attemptToReconnect();
    

    Parameters

    • Optional retryOptions: { maxRetryAttempts: number; retryIntervalInMs: number }
      • maxRetryAttempts: number
      • retryIntervalInMs: number

    Returns void

  • broadcastWsData(msg: any): void
  • Method to broadcast websocket data to non-leader tab

    example
    • this.broadcastWsData

    Parameters

    • msg: any

    Returns void

  • checkWssHeartBeat(heartBeatIntervalMilliSec: number): void
  • Method to keep WSS connection alive

    example
    • this.checkWssHeartBeat

    Parameters

    • heartBeatIntervalMilliSec: number

    Returns void

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

    example
    close();
    

    Parameters

    • Optional wsWorker: any

    Returns void

  • connect(websocketUrl: string, wsWorker?: any): void
  • This function used to make connection with websocket server

    example
    connect('ws://localhost:8089');
    

    Parameters

    • websocketUrl: string
    • Optional wsWorker: any

    Returns void

  • handleInternetDisruption(): void
  • Method to check the internet connection and handle the ping pong

    example
    • this.handleInternetDisruption();

    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
  • Completed callback method for websocket Subscription

    example
    • this.onClosed

    Returns void

  • onError(): void
  • Error callback method for websocket Subscription

    example
    • this.onError

    Returns void

  • onMessage(msg: any): void
  • Callback method when a message received from websocket server

    example
    • this.onMessage

    Parameters

    • msg: any

      message from server

    Returns void

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

    example
    • this.onOpen

    Returns void

  • onReconnectComplete(): void
  • onReconnectSuccess(): void
  • registerDigitalWebSocket(): void
  • Method to registerDigitalWebSocket

    example
    • this.registerDigitalWebSocket

    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

  • startWebSocket(): void
  • Used to open the webSocket data

    example
    startWebSocket();
    @param heartBeatIntervalMilliSec - time in milliseconds(Default = 5000 miliseconds)

    Returns void

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

    example
    this.terminateWebSocketWorker();
    

    Returns void

Generated using TypeDoc