[binance] future websocket error: connection closed by remote server

See original GitHub issue
  • OS: centos7
  • Programming Language version: NodeJS
  • CCXT version: ccxt.pro@0.3.55

We have been trading binance future with ccxt.pro and it has been working fine most of the times. However, every once in a while we receive the following errors:

  • connection closed by remote server, closing code 1006
  • Connection to wss://fstream.binance.com/ws timed out due to a ping-pong keepalive missing on time.

We suspect the code that cause the problem is the watchOrderBook method, but not 100% sure. Here is the full log for the first error.

 NetworkError: connection closed by remote server, closing code 1006
    at WsClient.onClose (/myProject/node_modules/ccxt.pro/js/base/Client.js:225:25)
    at WebSocket.onClose (/myProject/node_modules/ccxt.pro/node_modules/ws/lib/event-target.js:129:16)
    at WebSocket.emit (events.js:311:20)
    at WebSocket.EventEmitter.emit (domain.js:482:12)
    at WebSocket.emitClose (/myProject/node_modules/ccxt.pro/node_modules/ws/lib/websocket.js:191:10)
    at TLSSocket.socketOnClose (/myProject/node_modules/ccxt.pro/node_modules/ws/lib/websocket.js:858:15)
    at TLSSocket.emit (events.js:323:22)
    at TLSSocket.EventEmitter.emit (domain.js:482:12)
    at net.js:668:12           
    at TCP.done (_tls_wrap.js:556:7) {
  constructor: [Function: NetworkError],
  name: 'NetworkError'
}

Issue Analytics

  • State:open
  • Created 3 years ago
  • Comments:9 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
stella-dscommented, Feb 7, 2022

The latest ccxt is still experiencing the same issue , although the bug fix suggested by @FakePsyho is already added to cache.py. Is there any updates on this issue? Thanks!

3reactions
frosty00commented, Mar 16, 2021

@FakePsyho thanks for finding this bug, I’ve used your code to fix it just now

Read more comments on GitHub >

github_iconTop Results From Across the Web

Websocket closes unexpectedly with error 1006
Hello, in my experience working with the Binance web-socket “API” the issue with disconnects stems from the ping/pong handling. Particularly user-stream web- ......
Read more >
python - Cannot connect to Binance websocket. I get ...
The base urls for the futures are: wss://fstream.binance.com; wss://fstream3.binance.com. But if you just connect to these base urls you get ...
Read more >
WebSocket API - unexpected disconnections from market data ...
or the following where Python throws an exception when trying to read a new market data message from an already closed connection: websocket._exceptions....
Read more >
Errors with Binance connection - Quantower Help
"TimeStamp" error occurs when the time on the Binance server does not match the time on the user's computer.
Read more >
How to implement WebSocket API JavaScript application with ...
Figure-1: Web Workers and WebSocket connection diagram ... enables web pages to use the WebSockets protocol for two-way communication with a remote host....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found