From 51405858756e107304a908898d2ac6ea5a43f121 Mon Sep 17 00:00:00 2001 From: Adam Soltys Date: Thu, 30 Jul 2020 19:45:04 -0700 Subject: logout the earliest socket not the latest --- lib/sockets.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'lib') diff --git a/lib/sockets.js b/lib/sockets.js index 87317a16..514d701a 100644 --- a/lib/sockets.js +++ b/lib/sockets.js @@ -56,8 +56,8 @@ wss.on("connection", function (ws, req) { if (!sockets[username]) sockets[username] = {}; const existing = Object.keys(sockets[username]); if (existing.length > 5) { - l.warn("too many sockets, logging out", existing[0]); - sockets[username][existing[0]].send( + l.warn("too many sockets, logging out", existing[5]); + sockets[username][existing[5]].send( JSON.stringify({ type: "login", data: false }) ); } -- cgit v1.2.3