-
-
Notifications
You must be signed in to change notification settings - Fork 268
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for combined ws streams #143
Comments
Cheers!! I'm not sure how to create a combined stream with this API. I think I just made a workaround that makes it, but maybe you have it previously considered and can throw me a bone here. I'm trying to reach all 5m klines available in one stream. I've done it before directly with Binance API but I like the way you parse the response, so I made this: Is there a better way to do this? |
This seems like a way to do it. For the wskey, I would recommend to include all dynamic props...maybe something like symbols.sort().join().replace('USDT') isn't too long of a string? Reasoning is if you want to have multiple calls to this with diff symbols, you don't want any risk for wskeys to get mixed up. They should be unique, or when a reconnect happens you'll get the wrong websocket url being reconnected. maybe streamName (in getWsKeyWithContext) would also be good as something suggestive like |
Cheers! Done that and so far so good. I'll keep an eye on it and tell you if any errors comes up. Thanks again for your work!! |
Glad to hear! Would you mind sharing the snippet you're currently using? Are reconnects working OK? Would be great to add it to the lib. |
Yeah, already tried the reconnects and it went all fine. We were just talking in Telegram. I can send you anything else you need. The snippet to connect all the cryptos at the same time: `/**
`/**
|
There's two types of combined streams to support, each with a diff use case. The first one is easier than the second:
unsubscribe()
). Could just be a query in wsStore to find any/all wsKeys that have that topic.this.wsStore
, see the above partial implementation.Stretch goals for dynamic combined streams
The text was updated successfully, but these errors were encountered: