socket.io快捷查询事件表
io.on('connect', onConnect);
function onConnect(socket){
// 发送给当前客户端
socket.emit('hello', 'can you hear me?', 1, 2, 'abc');
// 发送给所有客户端,除了发送者
socket.broadcast.emit('broadcast', 'hello friends!');
// 发送给同在 'game' 房间的所有客户端,除了发送者
socket.to('ga
原创
2021-04-03 20:19:22 ·
194 阅读 ·
0 评论