Skip to content

Live Subscribing/Unsubscribing to streams #334

@KDVMan

Description

@KDVMan

https://binance-docs.github.io/apidocs/spot/en/#websocket-market-streams

Binance has this option:


**Live Subscribing/Unsubscribing to streams

The following data can be sent through the websocket instance in order to subscribe/unsubscribe from streams. Examples can be seen below.
The id used in the JSON payloads is an unsigned INT used as an identifier to uniquely identify the messages going back and forth.
In the response, if the result received is null this means the request sent was a success.**

Subscribe to a stream
Request

{
"method": "SUBSCRIBE",
"params":
[
"btcusdt@aggTrade",
"btcusdt@depth"
],
"id": 1
}


Unsubscribe to a stream
Request
{
"method": "UNSUBSCRIBE",
"params":
[
"btcusdt@depth"
],
"id": 312
}


Does your library have such an implementation? (I did not find it), if not, can you add it? Because as I understand it, if, for example, I call subscribeAggregateTrades 20 times for different coins, then I will open 20 connections, and the limit for binance seems to be 5
but I would like to be able to add and remove coins in an already open connection (for example, listen to 100 coins, then add 2 more, or remove 5)

thank you in advance

Metadata

Metadata

Assignees

No one assigned

    Labels

    WIPWork in progress, changes needed but reviews welcomeenhancementwebsockets

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions