X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=sockets.js;h=675a80eb6d51f7ba36941bf48dcdf36e2b843843;hb=4ecf423bce243e8e10b5b777a95f67ecc9f8d8d3;hp=ee4c1cfd802bd9fda8616534f014222c96c8457e;hpb=283d06a4401a937d602c4b863201945f1be3e701;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") {