JKorf / Binance.Net

A C# .netstandard client library for the Binance REST and Websocket Spot and Futures API focusing on clear usage and models
https://jkorf.github.io/Binance.Net/
MIT License
1.02k stars 420 forks source link

BinanceSocketClient - Can't connect to the server #1361

Closed AlgoExecutor closed 3 months ago

AlgoExecutor commented 3 months ago

Looks like there is a problem with BinanceClientSocket class. When I call the endpoint GetServerTime I get: Can't connect to the server Binance.Net Version 9.7.1

You can easily reproduce it with the following code:

 var socketClient = new BinanceSocketClient();
 var time = socketClient.SpotApi.ExchangeData.GetServerTimeAsync().Result;
 if(!time.Success)
     Console.WriteLine("Error: " + time.Error);

Debug Logging: fail: Binance[1001] [Sckt 1] connection failed: The server returned status code '403' when status code '101' was expected. System.Net.WebSockets.WebSocketException (203): The server returned status code '403' when status code '101' was expected. at System.Net.WebSockets.WebSocketHandle.ConnectAsync(Uri uri, CancellationToken cancellationToken, ClientWebSocketOptions options) at System.Net.WebSockets.ClientWebSocket.ConnectAsyncCore(Uri uri, CancellationToken cancellationToken) at CryptoExchange.Net.Sockets.CryptoExchangeWebSocketClient.ConnectInternalAsync()

AlgoExecutor commented 3 months ago

Ups, maybe i got blocked somehow.