Subscribe#
Users can choose to subscribe to one or more channels, with the total length of all channels not exceeding 64 KB.
Price channels and trading channels require authentication before subscription.
K-line (candlestick) channels do not require authentication.
Below is an example of request parameters. Each channel has different parameter requirements, so please subscribe according to the specific requirements of each channel.
Request Parameters#
Parameter | Type | Required | Description |
---|---|---|---|
op | String | Yes | Operation, subscribe |
args | Array | Yes | List of subscribed channels |
> channel | String | Yes | Channel name |
> chainIndex | String | Yes | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) |
> timestamp | String | Yes | Unix Epoch time, the unit is seconds |
> tokenContractAddress | String | Yes | Token contract address,for EVM please pass all-lowercase addresses (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) |
Response Parameters#
Parameter | Type | Description |
---|---|---|
event | String | Operation.subscribe or error |
arg | String | Subscribed channel |
> channel | String | Channel name |
> chainIndex | String | Unique identifier for the chain. (e.g., 1 for Ethereum. See ChainIndex) |
> tokenContractAddress | String | Token contract address (e.g., 0x382bb369d343125bfb2117af9c149795c6c65c50) |
code | String | Error code |
msg | String | Error message |
connId | String | WebSocket connection ID |
Request format description
{"op": "subscribe","args": ["SubscriptionTopic"]}
Request Example#
shell
{
"op": "subscribe",
"args": [{
"channel": "price",
"chainIndex": "1",
"tokenContractAddress": "0x382bb369d343125bfb2117af9c149795c6c65c50"
}]
}
Response Example#
200
{
"event": "subscribe",
"arg": {
"channel": "price",
"chainIndex": "1"
"tokenContractAddress":"0x382bb369d343125bfb2117af9c149795c6c65c50"
},
"connId": "accb8e21"
}