diff --git a/lib/realtime.js b/lib/realtime.js index af33cadf..86d361ef 100644 --- a/lib/realtime.js +++ b/lib/realtime.js @@ -260,7 +260,7 @@ function finishConnection(socket, note, user) { //clear finished socket in queue for (var i = 0; i < connectionSocketQueue.length; i++) { - if (connectionSocketQueue[i].id == socket.id) + if (!connectionSocketQueue[i] || connectionSocketQueue[i].id == socket.id) connectionSocketQueue.splice(i, 1); } //seek for next socket @@ -386,7 +386,7 @@ function disconnect(socket) { //clear finished socket in queue for (var i = 0; i < disconnectSocketQueue.length; i++) { - if (disconnectSocketQueue[i].id == socket.id) + if (!disconnectSocketQueue[i] || disconnectSocketQueue[i].id == socket.id) disconnectSocketQueue.splice(i, 1); } //seek for next socket