Skip to content

Commit cffb4eb

Browse files
committed
socket: fixed disconnect xhr url and made it actually sync
1 parent 46a4b9f commit cffb4eb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

lib/socket.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,8 +52,7 @@
5252
if (this.options['sync disconnect on unload'] &&
5353
(!this.isXDomain() || io.util.ua.hasCORS)) {
5454
var self = this;
55-
56-
io.util.on(global, 'unload', function () {
55+
io.util.on(global, 'beforeunload', function () {
5756
self.disconnectSync();
5857
}, false);
5958
}
@@ -362,11 +361,12 @@
362361
, this.options.host + ':' + this.options.port
363362
, this.options.resource
364363
, io.protocol
364+
, ''
365365
, this.sessionid
366-
].join('/') + '?disconnect';
366+
].join('/') + '/?disconnect=1';
367367

368-
xhr.open('GET', uri, true);
369-
xhr.send(null);
368+
xhr.open('GET', uri, false);
369+
xhr.send(null);
370370

371371
// handle disconnection immediately
372372
this.onDisconnect('booted');

0 commit comments

Comments
 (0)