NodeJS中的Broadcost按摩

时间:2016-04-15 15:47:29

标签: node.js

当我广播邮件发件人客户端时,也会收到来自NodeJs的通知,这里是我的代码,任何发送获取通知的机会

socket.on('Room', function(data) {
   console.log(' Room : '+data);
   socket.broadcast.emit('Room', {'Room': 'Room'});
});

1 个答案:

答案 0 :(得分:1)

Send response to all clients except sender (Socket.io)

// sending to all clients in 'game' room(channel) except sender
socket.broadcast.to('game').emit('message', 'nice game');