window.beforeunload event kills sockjs connection #170

jackp opened this Issue Jun 2, 2012 · 3 comments


None yet
4 participants

jackp commented Jun 2, 2012


I currently have a function that goes something like this:

var changed = true;
var intervalID = setInterval(function(){
  console.log('changed = ' + changed);
  if(changed){, id, story, function({
      changed = false;
}, 10000);

window.onbeforeunload = function(e){
  e = e || window.event;
      e.returnValue = 'warning message...';
    return 'warning message...';

The onbeforeunload event works, but if you choose to "stay on page" in the alert box, it seems to kill the sockjs connection. The interval function continues to run, but the function does not.

When I insert Meteor.status(), it says that meteor is still connected. I even tried using Meteor.reconnect and it did not work.

Any ideas?


debergalis commented Sep 19, 2012

Also see #339


avital commented Nov 25, 2012

I think this is sockjs/sockjs-client#90


glasser commented Apr 19, 2014

The linked sockjs bug was fixed and we've had that version in meteor for a while. Closing; we can reopen if somebody says this is still an issue.

@glasser glasser closed this Apr 19, 2014

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment