+ // TODO: if newmove, change "from" field to fully specified sid + tmpId
+ // ==> allow "gotmove" messages to be fully targetted
+ // Special case re-send newmove only to opponent:
+ if (!!obj.target) {
+ Object.keys(clients[page][obj.target]).forEach(x => {
+ send(
+ clients[page][obj.target][x],
+ {code: "newmove", data: obj.data}
+ );
+ });
+ }
+ else notifyRoom(page, obj.code, {data: obj.data});
+ break;
+
+ case "gotmove":
+ // TODO: should fully specify the target and be included in the last case below
+ if (!!clients[page][obj.target]) {
+ Object.keys(clients[page][obj.target]).forEach(x => {
+ send(
+ clients[pg][obj.target][x],
+ {code: "gotmove", data: obj.data}
+ );
+ });
+ }