Well the question is simple, can I subscribe/unsubscribe if I use /stream?streams
Yes. There is no functional difference between the streams listed in streams
parameter on connection and the streams you subscribe to using "method": "SUBSCRIBE"
. You can unsubscribe from any stream, or subscribe to additional streams later. You can even not subscribe to any stream, connecting to just wss://stream.binance.com/stream
, and then choose the streams.
Ok, I saw that it works but the {stream} property is lost, which is what interests me to track the listenkey, I will continue using the way to pass the parameters online, although I do not like that when changing the symbol in the case of an isolated market I have to close and reopen the websocket just to change the listenkey, and in other topics I have seen comments that it would be easier if they added the {stream} property in the response when using subscribe and I join the request hoping that in the future pay attention to us
@Saratoga, what do you mean by lost? When I connect to /stream
, there’s always "stream"
and "data"
in JSON. There is another way, connecting to /ws/<stream-name>
with a single stream. But you can switch to the “stream” from there as well, by sending
{"id":0,"method":"SET_PROPERTY","params":["combined",true]}
Sorry, I was connecting to the socket that uses /ws instead of the one that uses /stream (I have two sockets), I thought I had already changed the subscriptions to use the other socket