Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/manager.js
Original file line number Diff line number Diff line change
Expand Up @@ -468,13 +468,14 @@ Manager.prototype.onClientMessage = function (id, packet) {
* @api private
*/

Manager.prototype.onClientDisconnect = function (id, reason) {
Manager.prototype.onClientDisconnect = function (id, reason, local) {
for (var name in this.namespaces) {
this.namespaces[name].handleDisconnect(id, reason, typeof this.roomClients[id] !== 'undefined' &&
typeof this.roomClients[id][name] !== 'undefined');
}

this.onDisconnect(id);
if (local) this.store.publish('disconnect', id);
this.onDisconnect(id, local);
};

/**
Expand Down
5 changes: 3 additions & 2 deletions lib/transport.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,14 +457,15 @@ Transport.prototype.end = function (reason) {
if (!this.disconnected) {
this.log.info('transport end');

var local = this.manager.transports[this.id];
var local = !!this.manager.transports[this.id];

this.close();
this.clearTimeouts();
this.disconnected = true;


if (local) {
this.manager.onClientDisconnect(this.id, reason, true);
this.manager.onClientDisconnect(this.id, reason, local);
} else {
this.store.publish('disconnect:' + this.id, reason);
}
Expand Down