Sending messages to multiple rooms using Socket.io?
channel, node.js, socket.io
Solution
The sockets.in method only accepts one room as an argument, so to broadcast to multiple rooms you would have to reset the room, in between emissions. Something like this should work:
['room1', 'room2', 'room3'].forEach(function(room){
io.sockets.in(room).emit("id", {});
});
Problem
Is it possible to send messages to multiple rooms using socket.io? Sending to 1 room: ``` io.sockets.in(room).emit("id", {}) ``` Sending to N rooms: ``` io.sockets.in(room1, room2, roomN).emit("id", {}) ```