You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When the client shutdown gently, like powers off, a normal reboot or even unplugging the network, works well, but in case of client disconnect suddenly like halt force, reboot force, power down... the server keeps waiting to read forever.
websocket.h
voiddo_read()
{
...
adaptor_.socket().async_read_some (..... // here wait forever.
...
TCP connections (and websockets by extension) don't have a mechanism to detect a power outage. Usually keepalive functionality is implemented by the application. I've seen multiple websocket server require a ping signal every x seconds, otherwise the server terminates the connection.
This might be a thing worth adding to Crow in the future
The-EDev
changed the title
Dangling Websockets connections
Add optional keep-alive mechanism to WS connections
Jul 22, 2022
As an idea, I implemented it by adding another callback handler to the WebSocket connection so the protocol would be like the developer wants, either a ping/pong mechanism, close connection directly, or whatever.
Hi
When the client shutdown gently, like powers off, a normal reboot or even unplugging the network, works well, but in case of client disconnect suddenly like halt force, reboot force, power down... the server keeps waiting to read forever.
websocket.h
Here is an abstract of my test server code.
In the current CrowCpp (1.0+3 cause I use conan.io) I don't see how to avoid this (for now I have had to change websocket.h by adding a timer)
Is this a bug, or am I missing something?
The text was updated successfully, but these errors were encountered: