websocket
websocket copied to clipboard
After a long time of listen, the Binance will close ws connection [question]
After a long time of listen(more than 10 hour), the Binance will close ws connection, and should redail the connection, if not, will receive a lot of read err msg.
Is there any way to avoid this problem?
@ybina hello, are you talking about https://github.com/binance/binance-spot-api-docs/blob/master/web-socket-streams.md ?
If yes, the link above mentions:
A single connection to stream.binance.com is only valid for 24 hours; expect to be disconnected at the 24 hour mark
So it seems normal that binance WS API disconnects connection from time to time. From the client perspective you need to handle Read
error and reconnect to a server.