3.3.7 socket.emit(eventName,[...args][,ack])
socket.emit('hello','world');
socket.emit('with-binary',1,'2',{3:"4",5:new Buffer(6)});socket.emit('ferret','tobi',data=>{
console.log(data) // data 将是 'woot'
})
// 服务器:
// io.on('connection',socket=>{
// socket.on('ferrec',(name,fn)=>{
// fn('woot');
// })
// })Last updated
Was this helpful?