Open paupuerta opened 2 years ago
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
Great!
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.
If you want, I can share my approximation.
Regards
I thought of an approach that uses an app parameter and the task_timer, but please feel free to share your version :)
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?