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

sync on unload doesn't work for XHR-Polling or JSONP #431

Closed
crickeys opened this issue May 13, 2012 · 2 comments
Closed

sync on unload doesn't work for XHR-Polling or JSONP #431

crickeys opened this issue May 13, 2012 · 2 comments

Comments

@crickeys
Copy link
Contributor

I can't get the disconnectSync to actually disconnect the client if they close their browser in chrome (haven't tried elsewhere yet). To reproduce:

  1. Start a socket server with only XHR polling or only JSONP polling transports and debug log on
  2. Open connection in chrome (You'll see the handshake and connection in the debug log
  3. Close the browser tab
  4. Nothing registers on the server side.
@bajtos
Copy link

bajtos commented Aug 5, 2013

You can ask the client to notify the server about disconnect by turning on the flag sync disconnect on unload:

var socket = io.connect('http://localhost', {
  'sync disconnect on unload': true
});

This solution has some shortcomings though, see this pull request for more details.

See also a related StackOverflow question & answer.

@mattcodez
Copy link

Is there a server-side solution for this issue? While the client option works on desktop browsers, I'd still prefer not to rely on the client to inform the server of a disconnect.

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