diff --git a/lib/server.js b/lib/server.js index e34c3b9de..9de3de03e 100644 --- a/lib/server.js +++ b/lib/server.js @@ -311,7 +311,8 @@ Server.prototype._start = function (config, launcher, preprocess, fileList, webS // TODO(vojta): change the client to not send the event (if disconnected by purpose) var sockets = socketServer.sockets.sockets - sockets.forEach(function (socket) { + Object.keys(sockets).forEach(function (id) { + var socket = sockets[id] socket.removeAllListeners('disconnect') if (!socket.disconnected) { // Disconnect asynchronously. Socket.io mutates the `sockets.sockets` array