这两者有什么区别?
我注意到,如果我从改变socket.emit到socket.send在一个工作程序,服务器无法接收消息,虽然我不明白为什么.
socket.emit
socket.send
我还注意到,在我的程序,如果我从改变socket.emit到socket.send,服务器接收到消息,但它似乎多次接受它.当我console.log()用来查看服务器收到的内容时,它会显示与我使用时不同的内容socket.emit.
console.log()
为什么会这样?你怎么知道何时使用socket.emit或socket.send?
sockets node.js socket.io
node.js ×1
socket.io ×1
sockets ×1