WSS connection ist closed by the remote host

Hi,

we encoded the issue, that sometimes (e.g. 4-5 times a minute) the websocket connection ist closed by infura. The error startet since the last friday. Does someone have a similar problem or solution?

Nethereum.JsonRpc.Client.RpcClientUnknownException: Error occurred when trying to web socket requests(s)
 ---> System.Net.WebSockets.WebSocketException (0x80004005): The remote party closed the WebSocket connection without completing the close handshake.
 ---> System.IO.IOException: Unable to read data from the transport connection: An established connection was aborted by the software in your host machine..
 ---> System.Net.Sockets.SocketException (10053): An established connection was aborted by the software in your host machine.

Thanks for your help!

Hi @richardliebmann - welcome to the Infura community! Can you send over the code you’re using that’s causing this error message to show up? Without seeing that, I would suggest checking to make sure your WebSocket request isn’t returning information until you’re actually finished with the socket.

Hi Leiya,

thanks for your replay.

// open websocket connection
var client = new WebSocketClient(config.WebsocketUrl);
var web3 = new Web3(client);

// get multiple blocks in a loop
block = await web3.Eth.Blocks.GetBlockWithTransactionsByNumber.SendRequestAsync(new HexBigInteger(blockHeight));

The error couldn’t be reproduced very good, but occures 4-5 times a minute. Any ideas, why this happen?

Hi @richardliebmann - are you using CORS? This sometimes will occur if a person is using CORS - you’d need to download the CORS extension in Chrome, enable it, and in Intercepted URLs, copy the route you want.

Otherwise, the consensus seems to be that this error can largely be ignored, as it’s usually just a reflection of your browser connection no longer being there when the WSS is trying to write its output.