socket.io-client-csharp
socket.io-client-csharp copied to clipboard
Quick Socket Disconnection Detection in SocketIOClient
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:
- Is there a built-in way to configure ping/pong timeout detection that I'm missing?
- Are there plans to implement
pingTimeoutandpingIntervaloptions similar to the JavaScript client? - 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
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 - 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 ?