X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=sockets.js;h=675a80eb6d51f7ba36941bf48dcdf36e2b843843;hb=15c1295af871a5f416b0e5b43127512c8095497a;hp=ee4c1cfd802bd9fda8616534f014222c96c8457e;hpb=331fc58c932d6d7055b202d0c6dc0d77212a89f8;p=vchess.git diff --git a/sockets.js b/sockets.js index ee4c1cfd..675a80eb 100644 --- a/sockets.js +++ b/sockets.js @@ -25,6 +25,12 @@ module.exports = function(wss) { const params = new URL("http://localhost" + req.url).searchParams; const sid = params.get("sid"); const page = params.get("page"); + // Ignore duplicate connections: + if (!!clients[page][sid]) + { + socket.send(JSON.stringify({code:"duplicate"})); + return; + } clients[page][sid] = socket; if (page == "index") {