X-Git-Url: https://git.auder.net/?p=vchess.git;a=blobdiff_plain;f=server%2Fsockets.js;h=cf5ea1b82bbc558f9f87c651f4c16c607b91b48e;hp=42a8840fc51fb014e593c6312b9315b62ca50ca4;hb=db1f1f9adb920605c7a16b060a7737e54636ee08;hpb=e891730f77312340d68bb7ef72a4207541fa3914 diff --git a/server/sockets.js b/server/sockets.js index 42a8840f..cf5ea1b8 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -190,8 +190,30 @@ module.exports = function(wss) { case "abort": case "drawoffer": case "draw": + { notifyRoom(page, obj.code, {data:obj.data}); + const mygamesPg = "/mygames"; + if (obj.code == "newmove" && clients[mygamesPg]) + { + // Relay newmove info to myGames page + // NOTE: the move itself is not needed (for now at least) + const newmoveForMygames = { + gid: page.split("/")[2] //format is "/game/gid" + }; + obj.data.players.forEach(pSid => { + if (clients[mygamesPg][pSid]) + { + Object.keys(clients[mygamesPg][pSid]).forEach(x => { + send( + clients[mygamesPg][pSid][x], + {code:"newmove", data:newmoveForMygames} + ); + }); + } + }); + } break; + } case "result": // Special case: notify all, 'transroom': Game --> Hall