1

I'm trying to implement the binance specification for their API using C#. After building the foundation, I tried to reach wss://stream.binance.com:9443/ws/. But each time I use the code below to connect, the application stops abruptly whith no exception.

 using CancellationTokenSource tcs = new CancellationTokenSource(TimeSpan.FromSeconds(10));
            await _socket.ConnectAsync(BaseUri, tcs.Token).ConfigureAwait(false);

Of course, with BaseUri = wss://stream.binance.com:9443/ws/ and ClientWebSocket _socket . I've seen people talking about a handshake message, but could not find anything on binance doc. I'm i doing something wrong?

UPDATE : How can i at least debug this ? The connect method doesn't return any data...

  • There's an open source library to talk to Binance from C#: https://github.com/binance/binance-connector-dotnet – NineBerry Dec 09 '22 at 23:19
  • Thanks for sharing. I'm actually taking a look at their code. They seem to subscribe directly to streams without the "Connect" part. Hope I can annswer myself today ! – Aymane EL Jahrani Dec 10 '22 at 09:22

1 Answers1

0

Refer to this link for the solution. I now get a 400 bad request instead which helps a lot !

ClientWebSocket.ConnectAsync crashes with out any error info