Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #667 from dshaw/patch/redis-disconnect

Patch/redis disconnect
  • Loading branch information...
commit 9a8c1c4ae79a606493186cd8dabc7886c48505fd 2 parents eeaca6d + c110036
Guillermo Rauch rauchg authored
Showing with 6 additions and 4 deletions.
  1. +3 −2 lib/manager.js
  2. +3 −2 lib/transport.js
5 lib/manager.js
View
@@ -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);
};
/**
5 lib/transport.js
View
@@ -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);
}
Please sign in to comment.
Something went wrong with that request. Please try again.