Skip to content

Closing one WebSocket connection inadvertently closes another #900

Description

@vladimir-cloudypro

Description:

When utilizing two separate WebSocket connections (trades and bookTickers), terminating one with binance.websockets.terminate(pair) causes the other to close as well, despite them being distinct. Additionally, this behavior is observed even when the node-binance-api.js file is duplicated and used separately for each WebSocket.

Steps to Reproduce:

  1. Initialize two separate WebSocket connections: one for trades and one for bookTickers.
  2. Use distinct instances of node-binance-api.js for each WebSocket.
  3. Terminate one of the WebSocket connections using binance.websockets.terminate(pair).
  4. Observe that the other WebSocket connection also closes.

Expected Behavior:

Terminating one WebSocket should not affect the other, especially when they are managed by separate instances of node-binance-api.js.

Actual Behavior:

Terminating one WebSocket connection leads to the inadvertent closure of the other.

Environment:

Node version: 18.18.0
Library version: node-binance-api v0.13.0
OS: macOS 12.7

Additional Information:

Both WebSocket connections are set up and managed independently.
The issue persists even after ensuring separate event handlers for each connection.
I'm closing the websocket using binance.websockets.terminate(pair)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions