X-Git-Url: https://git.auder.net/img/rock_paper_scissors_lizard_spock.gif?a=blobdiff_plain;f=server%2Fsockets.js;h=206c780ffabc06ff307a228f71e35cbbf92188b6;hb=658c47bf5843fb0855659f22f7b1c38318c66ce5;hp=42a8840fc51fb014e593c6312b9315b62ca50ca4;hpb=8477e53d8e78606e4c4e4bf91c77b1011aab583c;p=vchess.git diff --git a/server/sockets.js b/server/sockets.js index 42a8840f..206c780f 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -190,8 +190,28 @@ 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 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", gid:gid} + ); + }); + } + }); + } break; + } case "result": // Special case: notify all, 'transroom': Game --> Hall