.NET WebSockets forcibly closed despite keep-alive and activity on the connection

前端 未结 2 608
梦谈多话
梦谈多话 2020-12-28 15:53

We have written a simple WebSocket client using System.Net.WebSockets. The KeepAliveInterval on the ClientWebSocket is set to 30 seconds.

The connection is opened su

2条回答
  •  隐瞒了意图╮
    2020-12-28 16:14

    I set the KeepAliveInterval for the socket to 0 like this:

    theSocket.Options.KeepAliveInterval = TimeSpan.Zero;
    

    That eliminated the problem of the websocket shutting down when the timeout was reached. But then again, it also probably turns off the send of ping messages altogether.

提交回复
热议问题