Skip to content

Commit

Permalink
send leave event to room members
Browse files Browse the repository at this point in the history
  • Loading branch information
atsushi-kambayashi committed Apr 27, 2015
1 parent 0187de5 commit dfb8a63
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lib/server.js
Expand Up @@ -337,10 +337,22 @@ app._processOutstanding = function(key, id) {
app._removePeer = function(key, id) {
if (this._clients[key] && this._clients[key][id]) {
var client = this._clients[key][id];
var room = client.room;
this._ips[this._clients[key][id].ip]--;
delete this._clients[key][id];
delete this._room_members[client.room][id];

// send to members
var members = Object.keys(this._room_members[room]);
for (var k = 0, kk = members.length; k < kk; k += 1) {
var member = members[k];
this._handleTransmission(key, {
type: "LEAVE",
src: id,
dst: member
});
}

console.log(this._clients);
console.log(this._ips);
console.log(this._room_members);
Expand Down

0 comments on commit dfb8a63

Please sign in to comment.