- // 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}
- );
- });
+ if (
+ !!clients[page][obj.target[0]] &&
+ !!clients[page][obj.target[0]][obj.target[1]]
+ ) {
+ send(
+ clients[page][obj.target[0]][obj.target[1]],
+ {code: "gotmove", data: obj.data}
+ );