Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Example for implementing idle session timeout #70

Open
omerkirk opened this issue Sep 22, 2022 · 4 comments
Open

Example for implementing idle session timeout #70

omerkirk opened this issue Sep 22, 2022 · 4 comments

Comments

@omerkirk
Copy link

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.

@olahol
Copy link
Owner

olahol commented Sep 26, 2022

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').

@kokteyldev
Copy link

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.

@youngsailor
Copy link

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
Copy link
Owner

olahol commented Mar 8, 2023

In v1.1.2 HandleDisconnect should now run more reliably.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants