The goal is to list users in rooms, so a room can contain many users and should be easily retrieved:
ex:
user1 = {"username":"john","sex":"male"};
user2 = {"username":"robert","sex":"male"};
user3 = {"username":"isac","sex":"male"};
rooms["room1"].push(user1);
rooms["room1"].push(user2);
rooms["room2"].push(user3);
and then
return rooms["room1"];
should return
{"username":"john","sex":"male"};
{"username":"robert","sex":"male"};
of course rooms[roomName].push(user2);
is not good
Any idea on how to achieve that ?