Troubleshooting

How to Connect to Binance WebSocket Real-Time Data Streams?

Published on 2026-03-23 | 8 min

How to connect to Binance WebSocket real-time data streams, available data types, connection management, and common troubleshooting — for developers who need real-time market data.

Want real-time market data from Binance? WebSocket is the best method — low latency, doesn't consume REST API weight, and data is pushed in real time.

WebSocket Basics

WebSocket is a bidirectional communication protocol. Unlike HTTP requests, once a WebSocket connection is established, it continuously receives server-pushed data without repeated requests.

In crypto trading, WebSocket is mainly used for:

  • Real-time prices
  • Real-time trade records
  • Depth data (order book)
  • Kline (candlestick) data
  • Account information changes

Binance WebSocket Endpoints

After registering on Binance, Binance provides these WebSocket endpoints:

Public Data Streams (no API key required)

Base endpoint: wss://stream.binance.com:9443/ws/<streamName>

Combined endpoint: wss://stream.binance.com:9443/stream?streams=<stream1>/<stream2>

User Data Streams (API key required)

First create a listenKey via the REST API, then use it to connect to WebSocket for your account's real-time data.

Available Public Data Streams

Individual Trade (Trade)

Get every trade record for a trading pair.

  • Stream name: btcusdt@trade
  • Data: price, quantity, buy/sell direction, time

Kline Data

Get real-time kline updates.

  • Stream name: btcusdt@kline_1m (1-minute kline)
  • Supports multiple intervals: 1m, 5m, 15m, 1h, 4h, 1d, etc.

Depth Data

Get order book changes.

  • Stream name: btcusdt@depth or btcusdt@depth@100ms
  • Data: changes in buy/sell orders

24-Hour Ticker Statistics

Get 24-hour statistics for one or all trading pairs.

  • Stream name: btcusdt@ticker or !ticker@arr (all pairs)

Latest Price

Get the latest trade price for one or all trading pairs.

  • Stream name: btcusdt@miniTicker

User Data Streams

Get real-time account information:

  1. Obtain a listenKey via REST API: POST /api/v3/userDataStream
  2. Connect WebSocket: wss://stream.binance.com:9443/ws/<listenKey>
  3. Receive real-time pushes:
    • Account balance changes
    • Order status updates
    • Trade notifications

Note: The listenKey must be renewed every 60 minutes (via PUT request), or the connection will be closed.

Connection Management Tips

Heartbeat

  • Send a ping every 3 minutes; the server responds with pong
  • If no pong is received within a certain time, reconnect

Reconnection on Disconnect

Connections may drop due to network instability. Your program needs auto-reconnect logic:

  • Detect disconnection
  • Wait briefly (1–5 seconds)
  • Re-establish connection
  • Re-subscribe to data streams

Subscription Limits

  • Maximum 200 data streams per single connection
  • For more, establish multiple connections

FAQ

Q: Is there latency in WebSocket data? Under normal conditions, latency ranges from tens to hundreds of milliseconds, depending on your network distance to Binance's servers.

Q: How to connect with Python? Use the websocket-client or websockets library. There are also ready-made Python Binance SDKs (like python-binance) that wrap WebSocket functionality.

Q: Can I subscribe to both spot and futures simultaneously? Spot and futures use different endpoints. The futures WebSocket endpoint is wss://fstream.binance.com/ws/<streamName>.

Q: What if data is lost? WebSocket doesn't guarantee 100% zero data loss. After reconnecting, supplement missing data using REST API calls.

If you haven't installed the app, download the Binance app first.

Summary

Binance WebSocket provides rich real-time data streams including market data, depth, klines, and user data. Simple to connect, low latency, and doesn't consume REST API weight. Ensure you implement heartbeat keep-alive and auto-reconnect. For quantitative trading and data analysis requiring real-time data, WebSocket is an essential tool.

Start Using Binance Today

Sign up with our exclusive referral link and enjoy a permanent trading fee discount

Register Now Download App