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.
#
Subscribe to a streamResponse
Request
"method": "SUBSCRIBE",
"params":
[
"btcusd_200925@aggTrade",
"btcusd_200925@depth"
],
"id": 1
}
#
Unsubscribe to a streamResponse
Request
{
"method": "UNSUBSCRIBE",
"params":
[
"btcusd_200925@depth"
],
"id": 312
}
#
Listing SubscriptionsResponse
Request
{
"method": "LIST_SUBSCRIPTIONS",
"id": 3
}
#
Setting PropertiesCurrently, the only property can be set is to set whether combined
stream payloads are enabled are not.
The combined property is set to false
when connecting using /ws/
("raw streams") and true
when connecting using /stream/
.
Response
Request
{
"method": "SET_PROPERTY",
"params":
[
"combined",
true
],
"id": 5
}
#
Retrieving PropertiesResponse
Request
{
"method": "GET_PROPERTY",
"params":
[
"combined"
],
"id": 2
}