diff --git a/lib/rooms.js b/lib/rooms.js index 294af6a..4b7fb8a 100644 --- a/lib/rooms.js +++ b/lib/rooms.js @@ -52,6 +52,7 @@ Room = function() { this.removeClient = function(clientId, callback) { delete clientMap[clientId]; + var clientIds = Object.keys(clientMap); var otherClient = clientIds.length > 0 ? clientMap[clientIds[0]] : null; callback(null, true, otherClient); }; @@ -102,4 +103,4 @@ Rooms = function() { } }; -module.exports = Rooms; \ No newline at end of file +module.exports = Rooms;