Using websockets to track potentially 10s of thousands of users


I’m looking to develop a trading bot for Binance that could potentially run into 10s of thousands of users.

My plan was to create a listenKey for each and somehow keep them alive then use websockets and subscribe each new listenKey so that every time a trade is filled on a users account Binance tells my application about this trade and then my application can react to this.

I’m aware the WSS is limited to 1024 streams per connection so some sort of load balancing will be needed where we’d have multiple connections and subscribe 1024 to each as the user base grows, the question I have is around the PONG messages.

If we have say 10 connections of 1024 streams, its not inconceivable that we could run into many PONGs being sent back, and therefore could send 5+ messages within a second which violates the connection conditions.

Are web sockets the right solution here or is there an alternative option available that I should be exploring.

Any help would be greatly appreciated


The Ping-Pong frames are sent as per connection every 3 minutes not per stream. Given the combination of stream function (Binance API Documentation), this is the most feasible way to maintain a large number users.