What is the proper way to manage multiple chat rooms with socket.io?
So on the server there would be something like:
io.sockets.on('connection', function (socket) {
socket.on('message', function (data) {
socket.broadcast.emit('receive', data);
});
});
Now this would work fine for one room, as it broadcasts the message out to all who are connected. How do you send messages to people who are in specific chat rooms though?
Add .of('/chat/room_name')? Or store an array of everybody in a room?