Websockets /ws vs steam?streams=... vs /ws/symbol@...

I was sadend to see that the current python/binance lib did not build on python asyncio, or similar, but asyncio is in the python standard lib, I think it’s the perfect candidate for the job. So I am reimplementing it from scrath, with intention to put it out there. This would offer the possibility to write eventdriven code, seems legit since there is very little IO going through http and websockets.

I’m done some testing of the your websockets steams, but it’s inconclusive, I am wondering if there is any actuall difference between the 4 diffrent steams… only on testnet.

Let’s say I connect to /ws and subscribe to bnbusdt@trade & bnbbtc@trade, does that differ from when doing ?steams=bnbusdt@trade/bnbtc@trade, does that differ from /ws/bnbusdt@trade and subscribing to bnbbtc@trade?

On the other hand if I connect /ws/account and subscribe to symbols, that actually differs since a the other ways of connecting cannot subscribe to account?

I’m think maybe theres good reason to enforce 1 combined socket, with maybe logical demultiplexing… Don’t know yet, hopefully you can give me some insight.

On another note I think your api is beatiful , your documontation is extrordinary and comprehensive. Seemlesses to integrate against. Good job.

thank you for you feedback.

  1. There is not much different between live subscription and subscribe by url.
    Some users like to dynamically subscript based on their requirement. Otherwise you can subscript by adding the stream names into url, make it easy to implement.

  2. /ws and /streams has little difference. When you subscribe multi streams in one connection, under /stream (combined mode), client will receive stream name on each message, make it easy to identify from each other.

2 Likes