Options
All
  • Public
  • Public/Protected
  • All
Menu

Class WebsocketClient Abstract

This is a base class to implement websocket

Hierarchy

Index

Constructors

Methods

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

    Parameters

    • reconnectInfo: WsReconnectInfo

      reconnectIntervalInMs in millisecond, maxReconnectAttempts in number and ws url

    • Optional wsWorker: any

    Returns void

  • This method to perform the different actions on callback response

    example
    checkWSEvent(event);
    

    Parameters

    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

  • onClosed(): void
  • Completed callback method for websocket Subscription

    Returns void

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

    Returns void

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

    Parameters

    • msg: any

      message from server

    Returns void

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

    Returns void

  • Callback method when a ws reconnect attempts in progress

    Parameters

    Returns void

  • onReconnectComplete(): void
  • Callback method when a ws reconnect attempts are completed

    Returns void

  • onReconnectSuccess(): void
  • Callback method when a ws reconnect attempts was successful

    example
    • this.onReconnectSuccess()

    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

Generated using TypeDoc