Checklist for debugging websocket disconnection

Nobody like Websocket abnormal disconnection, is there a list to check?

Websocket is essential for trading on Binance, but users may see disconnection that’s not as expected.
Before contacting Binance CS or tech support, please make sure you have looked into this list:

  • Client side network status
  • Failure in client side infrastructure. The server, network, etc.
  • Bug in the client application
  • Bug in the packages used by client’s application.
  • Unstable networking connection in client side, e.g. connected by WIFI.
  • Less powerful machine in the client side. e.g. the client is hosted on a mobile device or Raspberry Pi but listening to many streams.
  • Too much streams in one connection. Spot allows up to 1024 streams per connection, but is the client really need to subscribe so many streams?
    • reduce the streams amount per connection
    • improve the reading efficiency in the client application.
    • get a powerful machine, more CPU, memory, bandwidth, etc
  • use VPN/proxy? disconnect and try again.
  • Not respond to server’s ping? https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams
  • send invalid data to server over the connection? only valid json STRING format is allowed.
  • Spike in the client side or networking, try to reconnect.
2 Likes