websocketpp icon indicating copy to clipboard operation
websocketpp copied to clipboard

The event of disconnection in time is not called

Open Apsapeh opened this issue 3 years ago • 3 comments

Hello, I have a small WebSocket server in C++ which is used to create a lobby for my little game on Godot. The thing is that if the client is already connected for some time (about 20 minutes), when it disconnects, the disconnect event is not called.

Server code Server startup is main.cpp, data processing is data_received.cpp, disconnected processing is disconnected.cpp.

Sorry if the sentences are not composed very well, I used a translator.

Apsapeh avatar May 06 '22 16:05 Apsapeh

https://datatracker.ietf.org/doc/html/rfc6455#section-5.2 says:

    * %x8 denotes a connection close

I suggest you run Wireshark on the server's host and see if it receives that code when the client disconnects. If not, then run Wireshark on the client's host and see if it sends the code.

Or you could use lack of a heartbeat to know that a client is lost. See https://datatracker.ietf.org/doc/html/rfc6455#section-5.5.3

Jacob-Burckhardt avatar May 09 '22 21:05 Jacob-Burckhardt