Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host

Hi everyone! I have this issues after 5-9min work in my soft.
It happen on Futures Websocket wss://fstream.binance.com/stream?streams=btcusdt@depth@100ms
WebSocket [ConnectToDepthStream()] [future] error: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host.

Any help I will appriciate. Thanks.

Hey,
What happens if you catch the exception and reopen the connection?

An exception catch on webSocket.Error += (sender, e) =>
{
logger.LogError($“WebSocket [ConnectToDepthStream()] [future] error: {e.Exception.Message}”);
};

This is my recconnect logic:

webSocket.Closed += (s, e) =>
{
Task.Delay(5000).ContinueWith(_ =>
{
ReconectCount++;
if (ReconectCount > 5)
{
// Can not open WebSocket;
return;
}
logger.LogInfo(ViewId + " Reconect to WebSocket #");
if (timerResetReconectCount != null) { timerResetReconectCount.Dispose(); }
timerResetReconectCount = new Timer(__ => { ReconectCount = 0;
timerResetReconectCount.Dispose(); }, null, 60 * 1000, 5000);

              ConnectToDepthStream();
          });

};

Sorry if my question wasn’t clear. What happens when you reopen the connection?

I do not know, most likely an issues related in binance server