From 00694a8a9847f9b7572f79f9e46611cfa66e99c9 Mon Sep 17 00:00:00 2001 From: Daniel Baulig Date: Mon, 19 Mar 2012 22:03:31 +0100 Subject: [PATCH] Fix issue #795 --- lib/socket.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/lib/socket.js b/lib/socket.js index 38542f48af..d9807f6dd2 100644 --- a/lib/socket.js +++ b/lib/socket.js @@ -291,12 +291,19 @@ Socket.prototype.disconnect = function () { if (!this.disconnected) { this.log.info('booting client'); - if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { - this.manager.transports[this.id].onForcedDisconnect(); + if ('' === this.namespace.name) { + if (this.manager.transports[this.id] && this.manager.transports[this.id].open) { + this.manager.transports[this.id].onForcedDisconnect(); + } else { + this.manager.onClientDisconnect(this.id); + this.manager.store.publish('disconnect:' + this.id); + } } else { - this.manager.onClientDisconnect(this.id); - this.manager.store.publish('disconnect:' + this.id); + this.packet({type: 'disconnect'}); + this.manager.onLeave(this.id, this.namespace.name); + this.$emit('disconnect', 'booted'); } + } return this;