Send response to all clients except sender

前端 未结 10 1639
囚心锁ツ
囚心锁ツ 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:01

    Other cases

    io.of('/chat').on('connection', function (socket) {
        //sending to all clients in 'room' and you
        io.of('/chat').in('room').emit('message', "data");
    };
    

提交回复
热议问题