From: Benjamin Auder Date: Mon, 9 Mar 2020 09:38:53 +0000 (+0100) Subject: Implement notifyAllBut() X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=commitdiff_plain;h=856f995c28ad1e23bec4e606b94a3f8446109323;p=vchess.git Implement notifyAllBut() --- diff --git a/server/sockets.js b/server/sockets.js index f3224f1f..7395af15 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,