I'm trying to connect to GDAX websocket feed from C# (Target Framework: Core 2.0)
I'm using this NodeJS implementation as a reference.
My code:
var ws = new WebSocket("wss://ws-feed.gdax.com");
ws.Security.AllowUnstrustedCertificate = true; // doesn't matter if I remove this line
ws.Send(json);
ws.MessageReceived += (sender, args) => _log.LogInformation(args.Message);
Where json (Reference):
{
"type": "subscribe",
"product_ids": [
"BTC-EUR"
],
"channels": [
"ticker"
]
}
I don't see any errors in the log and I tried different libraries for WebSocket. I'm fine with solutions that use other libraries.
The problem was that I was sending straight away after calling Open. I should wait and send on the Opened event.