- 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
- {
- // Notify all room except opponent and me:
- notifyRoom("/", "game", {game:obj.game}, [obj.oppsid]);
- }
+ case "startgame":
+ Object.keys(clients[page][obj.target]).forEach(x => {
+ if (obj.target != sid || x != tmpId)
+ send(clients[page][obj.target][x], {code:obj.code, data:obj.data});
+ });