Binance WebSocket Connection Issues

I’m experiencing frequent disconnections with my Binance Futures WebSocket connections. I tried so many things to fix it but not succesfull Here’s my current configuration:

Connection Architecture

  • Total symbols monitored: ~170 pairs (auto-discovered)
  • Connection pool setup:
    • Using multiple WebSocket connections (BinanceManagerPool)
    • MAX_SYMBOLS_PER_CONNECTION = 10
    • This results in ~20+ separate WebSocket connections
    • Using a “canary” connection (BTCUSDT only) for monitoring (because I thought it was only connection 0)
    • Each connection starts with 0.3 second stagger delay

WebSocket Configuration

python

# WebSocket URL
Base URL: wss://fstream.binance.com/ws

# Connection parameters
ping_interval: 30 seconds
ping_timeout: 10 seconds
TCP_NODELAY: enabled (for low latency)

# Subscription method
- Using bookTicker streams (best bid/ask only)
- Format: {symbol}@bookTicker
- Subscribing via POST message after connection opens
- Batch size: 5 streams per subscription message
- Delay between batches: 50ms

Reconnection Strategy

  • Exponential backoff: [2, 5, 10, 15, 20, 30, 45, 60] seconds
  • Canary connection: always 1 second reconnect
  • Using non-blocking Timer for reconnection
  • Max reconnect attempts: 10

Issue Pattern

  • Connections drop with code 1006 (abnormal closure) or None
  • Typically affects 10 symbols at a time (one connection)
  • Reconnections work but connections keep dropping cyclically
  • Running continuously for hours but with periodic disconnects

Questions

  1. Is there a limit on the number of concurrent WebSocket connections to Binance Futures?
  2. Is 10 symbols per connection optimal, or should I use more/fewer?
  3. Are there rate limits on subscription messages that could cause disconnections?
  4. Would using the combined streams endpoint be more stable than individual connections?

Any insights on best practices for monitoring 100+ symbols via WebSocket would be greatly appreciated.