I was reading the documentation and I can’t find an event that is emitted when disconnecting the websocket connection by binance.
I found the listenKeyExpired event, but the documentation says that this event is emitted when the listen key expires, which does not mean that the websocket is disconnected.
Is there an event that tells us that the websocket will be disconnected?
The connection/disconnection is part of the WebSocket protocol, it belongs to general knowledge on how to manage WebSockets, not related with Binance API usage, therefore not suppose to be in the Documentation.
Generally speaking, if server emits disconnection, a close signal is send through the WebSocket channel and the client should detect and have a handler method for it (which depends on the programming language).
If helpful, we have multiple language SDKs that connects to the API and is available for the Spot and Futures market at Binance · GitHub.
I use the official binance python-connector sdk. Does this connector automatically reconnect upon websocket disconnection?