olahol/melody

Example for implementing idle session timeout

Opened this issue · 4 comments

Hi,

Thank you for a great package, it is much cleaner and simpler to use compared to gorilla/websocket library.

I am developing a game server and need to implement an idle timeout, I've set PingPeriod and PongWait values however it doesn't timeout the session or close the connection. In the readme feature list it looks like this is included "Automatic handling of ping/pong and session timeouts" however I can't seem to get it to work. Can you add an example that includes a simple implementation.

The doc is a little confusing but the automatic ping/pong handling is for Websocket heartbeats which time out broken connection (i.e sessions that don't respond to the control frame 'ping').

That is right thank you, we are doing some cleanup on HandleDisconnect for each session and we realized there are sometimes sessions that are no longer available but the cleanup process didn't run for some reason. We are looking into it, our current understanding is in some cases HandleError runs but disconnecthandler is not called. I will update this issue when I complete debugging.

That is right thank you, we are doing some cleanup on HandleDisconnect for each session and we realized there are sometimes sessions that are no longer available but the cleanup process didn't run for some reason. We are looking into it, our current understanding is in some cases HandleError runs but disconnecthandler is not called. I will update this issue when I complete debugging.

I have the same problem. Have you solved your problem?

olahol commented

In v1.1.2 HandleDisconnect should now run more reliably.