X-Git-Url: https://git.auder.net/pieces/Cwda/n_white_knight.svg?a=blobdiff_plain;f=server%2Fsockets.js;h=d1489f71c394685ee45431d525c2c0d4dfb630fa;hb=584f81b93154313a3856112400b7df98e0eb2632;hp=f3224f1fa9fbf54c9f1f7d52bc57d86e5c3d3858;hpb=c292ebb2a014646005b01e27253c162f1d639387;p=vchess.git diff --git a/server/sockets.js b/server/sockets.js index f3224f1f..d1489f71 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -42,10 +42,10 @@ module.exports = function(wss) { }); }; // For focus events: no need to target self - const notifyAllButMe = (page,code,obj={}) => { + const notifyAllBut = (page,code,obj={},except) => { if (!clients[page]) return; Object.keys(clients[page]).forEach(k => { - if (k == sid) return; + if (except.includes(k)) return; Object.keys(clients[page][k]).forEach(x => { send( clients[page][k][x].socket, @@ -205,7 +205,7 @@ module.exports = function(wss) { case "rnewgame": // A rematch game started: players are already informed - notifyAllBut(page, "newgame", {data: obj.data}, [sid, obj.oppsid]); + notifyAllBut(page, "newgame", {data: obj.data}, [sid]); notifyAllBut("/", "newgame", {data: obj.data}, [sid, obj.oppsid]); notifyRoom("/mygames", "newgame", {data: obj.data}); break;