X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Fsockets.js;h=7de7abb94638189e3d0cc0c7f306e96d9f5ab2cb;hb=0234201fb338fc239d6f613c677fa932c7c3697c;hp=c8f3c7f80bd8fae9cbd3cb3eefcc6ca5df077bc8;hpb=28b32b4fc7c23b1c72bed68e1897576c5be46c3d;p=vchess.git diff --git a/server/sockets.js b/server/sockets.js index c8f3c7f8..7de7abb9 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -208,16 +208,13 @@ module.exports = function(wss) { case "drawoffer": case "rematchoffer": case "draw": - if (!!obj.oppsid) - // "newgame" message from Hall: do not target players - notifyAllBut(page, "newgame", {data: obj.data}, [sid, obj.oppsid]); - else notifyRoom(page, obj.code, {data: obj.data}); + notifyRoom(page, obj.code, {data: obj.data}); break; case "rnewgame": - // A rematch game started: players are already informed + // A rematch game started: + // NOTE: no need to explicitely notify Hall: the game will be sent notifyAllBut(page, "newgame", {data: obj.data}, [sid]); - notifyAllBut("/", "newgame", {data: obj.data}, [sid, obj.oppsid]); notifyRoom("/mygames", "newgame", {data: obj.data}); break; @@ -272,7 +269,7 @@ module.exports = function(wss) { case "notifynewgame": if (!!clients["/mygames"]) { obj.targets.forEach(t => { - const k = t.sid || idToSid[t.uid]; + const k = t.sid || idToSid[t.id]; if (!!clients["/mygames"][k]) { Object.keys(clients["/mygames"][k]).forEach(x => { send(