+ // Request only one client out of 2 (TODO: this is a bit heavy)
+ // Alt: ask game to all, and filter later?
+ Object.keys(gameSids).forEach(gid => {
+ const L = gameSids[gid].length;
+ const idx = L > 1
+ ? Math.floor(Math.random() * Math.floor(L))
+ : 0;
+ const rid = gameSids[gid][idx];
+ clients[rid].sock.send(JSON.stringify(
+ {code:"askgame", from: rid}));
+ });
+ break;
+ }
+ case "askfullgame":
+ 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}));