From cffb4ebdbd2c6a0bdfd1fdf2c0824bb5e715fdaf Mon Sep 17 00:00:00 2001 From: Guillermo Rauch Date: Wed, 1 Aug 2012 15:10:09 -0700 Subject: [PATCH] socket: fixed disconnect xhr url and made it actually sync --- lib/socket.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index db7ae5d9..463b58ef 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -52,8 +52,7 @@ if (this.options['sync disconnect on unload'] && (!this.isXDomain() || io.util.ua.hasCORS)) { var self = this; - - io.util.on(global, 'unload', function () { + io.util.on(global, 'beforeunload', function () { self.disconnectSync(); }, false); } @@ -362,11 +361,12 @@ , this.options.host + ':' + this.options.port , this.options.resource , io.protocol + , '' , this.sessionid - ].join('/') + '?disconnect'; + ].join('/') + '/?disconnect=1'; - xhr.open('GET', uri, true); - xhr.send(null); + xhr.open('GET', uri, false); + xhr.send(null); // handle disconnection immediately this.onDisconnect('booted');