- case "pollclients":
- const curPage = clients[sid].page;
- socket.send(JSON.stringify({code:"pollclients",
- sockIds: Object.keys(clients).filter(k => k != sid &&
- (clients[k].page == curPage ||
- // Consider that people playing are in Hall too:
- (curPage == "/" && clients[k].page.indexOf("/game/") >= 0))
- )}));
- break;
- case "pagechange":
- notifyRoom(clients[sid].page, "disconnect");
- if (clients[sid].page.indexOf("/game/") >= 0)
- notifyRoom("/", "disconnect");
- clients[sid].page = obj.page;
- notifyRoom(obj.page, "connect");
- if (obj.page.indexOf("/game/") >= 0)
- notifyRoom("/", "connect");
- break;
- case "askidentity":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"askidentity",from:sid}));
- break;
- case "askchallenge":
- clients[obj.target].sock.send(JSON.stringify(
- {code:"askchallenge",from:sid}));