From 02df9d9c8cdf731287138db091b4cd5b6b6c351b Mon Sep 17 00:00:00 2001 From: Pham Van Lam Date: Wed, 15 Mar 2017 11:04:34 +0700 Subject: [PATCH] fix removeClient function in Room Add var clientIds = Object.keys(clientMap); --- lib/rooms.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) 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;