Binance Connector JS
    Preparing search index...
    Index

    Constructors

    Methods

    • Disconnects from the WebSocket server. If there is no active connection, a warning is logged. Otherwise, all connections in the connection pool are closed gracefully, and a message is logged indicating that the connection has been disconnected.

      Returns Promise<void>

      A Promise that resolves when all connections have been closed.

      Error if the WebSocket client is not set.

    • Removes an event listener for the specified WebSocket event.

      Parameters

      • event: "open" | "message" | "error" | "close" | "ping" | "pong"

        The WebSocket event to stop listening for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.

      • listener: (...args: any[]) => void

        The callback function that was previously added as the event listener.

      Returns void

    • Adds an event listener for the specified WebSocket event.

      Parameters

      • event: "open" | "message" | "error" | "close" | "ping" | "pong"

        The WebSocket event to listen for, such as 'open', 'message', 'error', 'close', 'ping', or 'pong'.

      • listener: (...args: any[]) => void

        The callback function to be executed when the event is triggered. The function can accept any number of arguments.

      Returns void

    • Sends a ping message to all connected Websocket servers in the pool. If no connections are ready, a warning is logged. For each active connection, the ping message is sent, and debug logs provide details.

      Returns void

      Error if a Websocket client is not set for a connection.

    • Subscribes to one or multiple WebSocket streams Handles both single and pool modes

      Parameters

      • stream: string | string[]

        Single stream name or array of stream names to subscribe to

      • Optionalid: string

        Optional subscription ID

      Returns void

      void

    • Unsubscribes from one or multiple WebSocket streams Handles both single and pool modes

      Parameters

      • stream: string | string[]

        Single stream name or array of stream names to unsubscribe from

      • Optionalid: string

        Optional unsubscription ID

      Returns void

      void