RequestTimeout: timed out due to a ping-pong keepalive missing on time

See original GitHub issue
  • OS: linux
  • Programming Language version: node v16.17.1
  • CCXT version: 2.0.31

client = new ccxt.pro['binance']({
      newUpdates: true
    });
while (true) {
              try {
                const trades = await client.watchTrades(symbol);
                //doing things here
              } catch (e) {
                // debugger;
                console.log(e);
                // do nothing and retry on next loop iteration
                // throw e // uncomment to break all loops in case of an error in any one of them
                // break // you can also break just this one loop if it fails
              }
}
RequestTimeout: Connection to wss://stream.binance.com:9443/ws timed out due to a ping-pong keepalive missing on time

watchTrades on Binance every second minute the error is produced and simply things stop suddenly and can’t figure out how to even handle the error gracefully or re-subscribe

Issue Analytics

  • State:open
  • Created a year ago
  • Comments:16 (5 by maintainers)

github_iconTop GitHub Comments

2reactions
pcriadoperezcommented, Nov 16, 2022

Hi,

So I think there are two different issues here, the 1008 “Too many requests” error and the ping-pong keep alive error.

  • For the 1008 error, after a bunch of testing I found that the issue is we are only using one stream for all of our requests to binance. So even though they allow 1024 streams, we currently only use one, so when receiving too many messages over the stream it throws the 1008 error. I want to dig in more to this but I will be posting a PR with a solution shortly. This will also solve issue #12031

  • Second we have the ping-pong error. Unfortunately I still have not been able to reproduce this error. @nileio , I’m not sure this answers your comment above, but we do change the ping/pong logic depending on the exchange if needed. My suggestion here is, I’ll implement the multiple streams on binance which will remove the stress on each client, and as you mention it only happens when subscribing to a lot of markets, hopefully this will also solve the ping-pong issue. If not happy to continue looking into it.

1reaction
ttoduacommented, Dec 19, 2022

@nileio I am not working on this subject, you might tag @carlosmiei / @pcriadoperez / @sc0Vu to find out who is tracking this issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

athenawisdoms/binance-missing-pingpong-keepalive-problem
Connection to wss://stream.binance.com:9443/ws timed out due to a ping-pong keepalive missing on time. App uses only 1 exchange (binance), ...
Read more >
Strange WS connection timeouts when ramping users
Whenever i set the scenario to spawn all users at once, everything works fine (there has been only one rare case in which...
Read more >
Why my Websocket connections not getting trades after some ...
Hi I'm accessing Trade Streams (@trade) programatically, one websocket connection per symbol. I'm getting trades but after one to three minutes times trades ......
Read more >
Python websockets ping / pong / keep-alive errors
I'm getting two errors with practically the same meaning sent 1011 (unexpected error) keepalive ping timeout; no close frame received and no ...
Read more >
Timeouts - websockets 10.4 documentation - Read the Docs
Furthermore, WebSocket builds on top of HTTP/1.1 where connections are short-lived, even with Connection: keep-alive . Typically, HTTP/1.1 infrastructure closes ...
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