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

disconnect callback not instant #205

Open
rskumar opened this issue Nov 25, 2014 · 5 comments
Open

disconnect callback not instant #205

rskumar opened this issue Nov 25, 2014 · 5 comments

Comments

@rskumar
Copy link

rskumar commented Nov 25, 2014

Disconnect callback is not called instantly on client (browser) close. Rather it takes few seconds.
What can be best way, if possible to know instantly when client disconnects?

@gordol
Copy link

gordol commented Jan 30, 2015

Set a lower connection timeout in your server.

@gordol
Copy link

gordol commented Jan 30, 2015

:param heartbeat_interval: int The timeout for the server, we
should receive a heartbeat from the client within this
interval. This should be less than the
``heartbeat_timeout``.
:param heartbeat_timeout: int The timeout for the client when
it should send a new heartbeat to the server. This value
is sent to the client after a successful handshake.
:param close_timeout: int The timeout for the client, when it
closes the connection it still X amounts of seconds to do
re open of the connection. This value is sent to the
client after a successful handshake.

        :param heartbeat_interval: int The timeout for the server, we
            should receive a heartbeat from the client within this
            interval. This should be less than the
            ``heartbeat_timeout``.
        :param heartbeat_timeout: int The timeout for the client when
            it should send a new heartbeat to the server. This value
            is sent to the client after a successful handshake.
        :param close_timeout: int The timeout for the client, when it
            closes the connection it still X amounts of seconds to do
            re open of the connection. This value is sent to the
            client after a successful handshake.

@rskumar
Copy link
Author

rskumar commented Jan 31, 2015

Yes it works with that option lowered. Thanks @gordol

@gordol
Copy link

gordol commented Jan 31, 2015

No problem, just keep in mind, as you scale and have more users, the increased frequency of those heartbeats will lead to more traffic, and also on some mobile networks, there may be quite a bit of latency that will cause users to become disconnected by mistake if you set the interval too low.

Computationally, and in terms of bandwidth, re-negotiation of a connection is heavier and more resource intensive than waiting a few extra seconds for a client time-out. But, it's really a micro-optimization, at this point. Just things to consider later if/when you're scaling... Best of luck!

@ddduggguo
Copy link

@gordol
how to set that value?

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

3 participants