-
-
Notifications
You must be signed in to change notification settings - Fork 422
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
No reconnection when candle socket stream gets dropped #1108
Comments
What I'm wondering about is that if I keep below the 128 streams / socket, and open multiple sockets, I shouldn't get any drops, but they still drop regularly over time. |
Here is more info. My subscriptions are:
The first one is trades where I can subscribe to all the tickers at once and this is never a problem. And this runs well for many hours... And then this happened ~10 hours later:
I consider something missing when there is no data for that symbol for 1 minute. So it looks like we go disconnected, reconnected right away but the re-subscription is not working. |
Hi Thomas, this is rather hard to debug for me as well. The library should reconnect and resubscribe all topics when the reconnection is successful. If a resubscription on a reconnected socket fails the socket will be closed and resubscription will be tried again. Using the latest version, if you use Debug log level you should be able to log pretty much everything that's going on with the sockets, but not the data which is send/received. Is it in options to run with that? (I understand that previously running in Trace log level wasn't an option because of all the data being logged) |
Binance has a limit about the number of streams will it support on a socket. Right now, it stands at 128.
I'm grabbing the candles of the 139 futures with 8 timeframes per future, which means 139 * 8 = 1112 streams.
If you max out the number of streams / socket, Binance will just close the socket without telling you anything. And being at the max is not a good idea because a reply to a ping will open a new stream for the socket, and it will be dropped just like that.
I'm putting 120 streams per sockets, so I have: 139 futures * 8 time frames / 120 streams = 9 socket connections.
This means 15 futures / socket, and it works, I can stream all the data without problem.
But then I notice some streams are dropping sometimes. It's not regular, but rather random.
And when they're dropped, there is no connection / disconnection event sent.
I do not know if the library doesn't reconnect the socket, or if it reconnects but doesn't resend the subscription message. But, from my perspective, I can only know something is amiss when some futures don't have messages for a while.
I am wondering if Binance dropping the connection is detected. They don't send a notification saying it's being closed when you exceed the number of streams.
The text was updated successfully, but these errors were encountered: