X-Git-Url: https://git.auder.net/?a=blobdiff_plain;f=server%2Fsockets.js;h=e791293e11175cab3f6a9dd4d8ae1f3b36ad0fdd;hb=2c5d7b20742b802d9c47916915c1114bcfc9a9c3;hp=25abadb75dabba084cdaef362cb7c7dbce682d0e;hpb=0d5335de5c94d780e03ac0aa3279b731c69455cc;p=vchess.git diff --git a/server/sockets.js b/server/sockets.js index 25abadb7..e791293e 100644 --- a/server/sockets.js +++ b/server/sockets.js @@ -209,6 +209,9 @@ module.exports = function(wss) { clients[page][rid][rtmpId].socket, { code: "askfullgame", from: [sid,tmpId] } ); + } else { + // I'm the only person who have the game for the moment: + send(socket, { code: "fullgame", data: { empty: true } }); } } break; @@ -237,7 +240,8 @@ module.exports = function(wss) { case "rematchoffer": case "draw": // "newgame" message can provide a page (corr Game --> Hall) - notifyRoom(obj.page || page, obj.code, {data: obj.data}, obj.excluded); + notifyRoom( + obj.page || page, obj.code, {data: obj.data}, obj.excluded); break; case "rnewgame": @@ -333,8 +337,8 @@ module.exports = function(wss) { case "lastate": { const pg = obj.target[2] || page; //required for identity and game - // NOTE: if in game we ask identity to opponent still in Hall, - // but leaving Hall, clients[pg] or clients[pg][target] could be undefined + // NOTE: if in game we ask identity to opponent still in Hall, but + // leaving Hall, clients[pg] or clients[pg][target] could be undef. if (!!clients[pg] && !!clients[pg][obj.target[0]]) { send( clients[pg][obj.target[0]][obj.target[1]].socket,