I\'m trying to use the new \"room\" feature in Socket.io v.7 to create dynamic chat rooms, but I\'m having problems getting static rooms to work in my example. Based on the
You don't seem to be listening to these events
socket.broadcast.to(room).emit('new fan');
io.sockets.in(room).emit('new non-fan');
on the client side you need:
socket.on('new fan', function (data) {
console.log('new fan');
});
You're also not sending the message to the clients. Inside:
socket.on('message', function(data) { })
on the server, you need to do :
io.sockets.in(room).emit('message', data);