I have referred to the following resources:
https://docs.cloud.coinbase.com/exchange/docs/websocket-overview https://docs.cloud.coinbase.com/exchange/docs/websocket-channels
After I connect to wss://ws-feed.exchange.coinbase.com
, I send a subscribe message but it is always rejected by the server.
Example 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"}
Example 2:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "heartbeat", "product_ids": ["ETH-EUR"] }]
}
From coinbase: {"type":"error","message":"channel is required"}
Example 3:
To coinbase:
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
From coinbase: {"type":"error","message":"channel is required"}
Basically, I cannot subscribe to any channel.
Question> What did I do wrong here?
Thank you
Perhaps something is being cached where what you're sending isn't what you think you're sending? Because it worked perfectly for me here.
With wss://ws-feed.exchange.coinbase.com
as the url and
{
"type": "subscribe",
"channels": [{ "name": "status"}]
}
as the message.