LUCIT-Systems-and-Development / unicorn-binance-websocket-api

A Python SDK by LUCIT to use the Binance Websocket API`s (com+testnet, com-margin+testnet, com-isolated_margin+testnet, com-futures+testnet, com-coin_futures, us, tr, dex/chain+testnet) in a simple, fast, flexible, robust and fully-featured way.
https://unicorn-binance-websocket-api.docs.lucit.tech/
Other
683 stars 165 forks source link

Multiple Websocket Support #233

Closed Deidara6026 closed 2 years ago

Deidara6026 commented 2 years ago

Is your feature request related to a problem? Please describe. I'm creating a small webapp which will have users connecting via websockets to recieve data from binance.com. I intend to use userdata streams for this, but I noticed that binance has a limit of 1024 streams per connection.

Describe the solution you'd like I'd like for there to be some exception raised when this limit is reached. I'd like to catch that and open a second connection to handle the extras(If that's even possible). Another solution could also be having the websocket manager automatically open a new websocket connection when the previous is saturated.

Describe alternatives you've considered So far I've thought of keeping count of the number of streams added to an existing connection and creating a new one when the old one gets full.

Additional context Thats about it, thanks!

oliver-zehentleitner commented 2 years ago

Please take a look to this:

https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html?highlight=throw_exception_if_unrepairable#module-unicorn_binance_websocket_api.manager

https://unicorn-binance-websocket-api.docs.lucit.tech/unicorn_binance_websocket_api.html?highlight=subscriptions#unicorn_binance_websocket_api.manager.BinanceWebSocketApiManager.get_number_of_subscriptions