Send response to all clients except sender

前端 未结 10 1635
囚心锁ツ
囚心锁ツ 2020-11-22 14:26

To send something to all clients, you use:

io.sockets.emit(\'response\', data);

To receive from clients, you use:

socket.on         


        
10条回答
  •  渐次进展
    2020-11-22 15:17

    broadcast.emit sends the msg to all other clients (except for the sender)

    socket.on('cursor', function(data) {
      socket.broadcast.emit('msg', data);
    });
    

提交回复
热议问题