- // Since people can be both in Hall and Game,
- // need to track "askIdentity" requests:
- let identityAsked = {};
- // TODO: shuffling and random filtering on server, if
- // the room is really crowded.
- data.sockIds.forEach(s => {
- const page = s.page || "/";
- if (s.sid != this.st.user.sid && !identityAsked[s.sid]) {
- this.send("askidentity", { target: s.sid, page: page });
- identityAsked[s.sid] = true;
+ // TODO: shuffling and random filtering on server,
+ // if the room is really crowded.
+ Object.keys(data.sockIds).forEach(sid => {
+ if (sid != this.st.user.sid) {
+ // Pick a target tmpId (+page) at random:
+ const pt = Object.values(data.sockIds[sid]);
+ const randPage = pt[randInt(pt.length)].page;
+ this.send(
+ "askidentity",
+ {
+ target: sid,
+ page: randPage
+ }
+ );