如何订阅coinbase websocket?
How to subscribe to the coinbase websocket?
我参考了以下资源:
https://docs.cloud.coinbase.com/exchange/docs/websocket-overview
https://docs.cloud.coinbase.com/exchange/docs/websocket-channels
连接到wss://ws-feed.exchange.coinbase.com
后,我发送了一条订阅消息,但总是被服务器拒绝。
示例 1:
To coinbase:
{
"type": "subscribe",
"product_ids": [
"ETH-USD",
"ETH-EUR"
],
"channels": [
"level2",
"heartbeat",
{
"name": "ticker",
"product_ids": [
"ETH-BTC",
"ETH-USD"
]
}
]
}
From coinbase: {"type":"error","message":"channel is required"}
例二:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "heartbeat", "product_ids": ["ETH-EUR"] }]
}
From coinbase: {"type":"error","message":"channel is required"}
示例 3:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
From coinbase: {"type":"error","message":"channel is required"}
基本上,我无法订阅任何频道。
问题>我这里做错了什么?
谢谢
也许在您发送的内容与您认为发送的内容不同的地方缓存了某些内容?因为它非常适合我 here.
以wss://ws-feed.exchange.coinbase.com
作为url和
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
作为消息。
我参考了以下资源:
https://docs.cloud.coinbase.com/exchange/docs/websocket-overview https://docs.cloud.coinbase.com/exchange/docs/websocket-channels
连接到wss://ws-feed.exchange.coinbase.com
后,我发送了一条订阅消息,但总是被服务器拒绝。
示例 1:
To coinbase:
{
"type": "subscribe",
"product_ids": [
"ETH-USD",
"ETH-EUR"
],
"channels": [
"level2",
"heartbeat",
{
"name": "ticker",
"product_ids": [
"ETH-BTC",
"ETH-USD"
]
}
]
}
From coinbase: {"type":"error","message":"channel is required"}
例二:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "heartbeat", "product_ids": ["ETH-EUR"] }]
}
From coinbase: {"type":"error","message":"channel is required"}
示例 3:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
From coinbase: {"type":"error","message":"channel is required"}
基本上,我无法订阅任何频道。
问题>我这里做错了什么?
谢谢
也许在您发送的内容与您认为发送的内容不同的地方缓存了某些内容?因为它非常适合我 here.
以wss://ws-feed.exchange.coinbase.com
作为url和
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
作为消息。