+ notifyRoom("/", "result", { gid: obj.gid, score: obj.score });
+ break;
+
+ case "mconnect":
+ // Special case: notify some game rooms that
+ // I'm watching game state from MyGames
+ // TODO: this code is ignored for now
+ obj.gids.forEach(gid => {
+ const pg = "/game/" + gid;
+ Object.keys(clients[pg]).forEach(s => {
+ Object.keys(clients[pg][s]).forEach(x => {
+ send(
+ clients[pg][s][x].socket,
+ { code: "mconnect", from: sid }
+ );
+ });
+ });
+ });
+ break;
+ case "mdisconnect":
+ // TODO
+ // Also TODO: pass newgame to MyGames, and gameover (result)
+ break;
+ case "mabort": {
+ const gamePg = "/game/" + obj.gid;
+ if (!!clients[gamePg] && !!clients[gamePg][obj.target]) {
+ Object.keys(clients[gamePg][obj.target]).forEach(x => {
+ send(
+ clients[gamePg][obj.target][x].socket,
+ { code: "abort" }
+ );
+ });
+ }
+ break;
+ }
+
+ case "getfocus":
+ case "losefocus":
+ if (page == "/") notifyAllButMe("/", obj.code, { page: "/" });
+ else {
+ // Notify game room + Hall:
+ notifyAllButMe(page, obj.code);
+ notifyAllButMe("/", obj.code, { page: page });
+ }