let obj = JSON.parse(objtxt);
if (!!obj.target && !clients[obj.target])
return; //receiver not connected, nothing we can do
-
-console.log(obj.code);
-
switch (obj.code)
{
case "pollclients":
clients[obj.target].sock.send(JSON.stringify(
{code:"askchallenge",from:sid}));
break;
- case "askgame":
+ case "askgames":
// Check all clients playing, and send them a "askgame" message
Object.keys(clients).forEach(k => {
if (k != sid && clients[k].page.indexOf("/game/") >= 0)
{code:"askgame", from: sid}));
}
});
- clients[obj.target].sock.send(JSON.stringify(
- {code:"askgame",from:sid}));
break;
case "identity":
clients[obj.target].sock.send(JSON.stringify(