Created
July 23, 2011 18:44
-
-
Save 3rd-Eden/1101736 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// change this https://github.com/LearnBoost/socket.io/blob/master/lib/manager.js#L469 | |
if (this.roomClients[id]) { | |
for (var room in this.roomClients[id]) { | |
this.rooms[room].splice(this.rooms[room].indexOf(id), 1); | |
} | |
} | |
// to | |
if (this.roomClients[id]) { | |
for (var room in this.roomClients[id]) { | |
this.onLeave(id, room); | |
} | |
delete this.roomClients[id] | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// change | |
Manager.prototype.onLeave = function (id, room) { | |
if (this.rooms[room]) { | |
var index = this.rooms[room].indexOf(id); | |
if (index >= 0) { | |
this.rooms[room].splice(index, 1); | |
} | |
delete this.roomClients[id][room]; | |
} | |
}; | |
// to | |
Manager.prototype.onLeave = function (id, room) { | |
if (this.rooms[room]) { | |
var index = this.rooms[room].indexOf(id); | |
if (index >= 0) { | |
this.rooms[room].splice(index, 1); | |
} | |
if (!this.rooms[room].length) { | |
delete this.rooms[room]; | |
} | |
delete this.roomClients[id][room]; | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment