socket.io-client-csharp icon indicating copy to clipboard operation
socket.io-client-csharp copied to clipboard

Quick Socket Disconnection Detection in SocketIOClient

Open kkkkorsun opened this issue 10 months ago • 1 comments

Currently, I'm experiencing issues with slow disconnection detection in the SocketIOClient library. While the JavaScript Socket.IO client provides options like pingTimeout and pingInterval to configure how quickly connection loss is detected, these options seem to be missing in the C# implementation.

The ConnectionTimeout option only affects the initial connection and WebSocket upgrade, but not the ongoing connection monitoring. In our real-time application, we need to detect connection loss within 5-10 seconds, but currently it can take much longer.

Questions:

  1. Is there a built-in way to configure ping/pong timeout detection that I'm missing?
  2. Are there plans to implement pingTimeout and pingInterval options similar to the JavaScript client?
  3. If not, what would be the recommended approach to implement quick disconnection detection without manually tracking ping/pong timestamps?

Current workaround: We're currently tracking the last ping/pong time manually and force-closing the socket if no ping is received within N seconds, but this feels like something that should be handled by the library itself.

Environment:

  • SocketIOClient version: 3.1.2
  • Unity/C# application

kkkkorsun avatar Feb 07 '25 11:02 kkkkorsun

pingTimeout and pingInterval can be configured only on the server side. These are server-side options. If you want instant disconnect notifications use websocket transport and not long-polling.

NAsejevs avatar Mar 01 '25 13:03 NAsejevs

@NAsejevs - Does library has auto reply to ping received from server? if yes - why are we seeing lot of ping timeouts on server side? should we implement custom logic to reply ?

kondareddy avatar Nov 01 '25 00:11 kondareddy