- clients[obj.target].sock.send(JSON.stringify(
- {code:"askfullgame", from:sid}));
- break;
- case "fullgame":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"fullgame", game:obj.game}));
- break;
- case "identity":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"identity",user:obj.user}));
- break;
- case "refusechallenge":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"refusechallenge", cid:obj.cid, from:sid}));
- break;
- case "deletechallenge":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"deletechallenge", cid:obj.cid, from:sid}));
- break;
- case "newgame":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"newgame", gameInfo:obj.gameInfo, cid:obj.cid}));
- break;
- case "challenge":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"challenge", chall:obj.chall, from:sid}));
- break;
- case "game":
- if (!!obj.target)
- {
- clients[obj.target].sock.send(JSON.stringify(
- {code:"game", game:obj.game, from:sid}));
- }
- else
+ {
+ const pg = obj.page || page; //required for askidentity and askgame
+ const tmpIds = Object.keys(clients[pg][obj.target]);
+ if (obj.target == sid) //targetting myself