socket.emit() vs. socket.send()

后端 未结 6 1930
日久生厌
日久生厌 2020-12-02 04:04

What\'s the difference between these two?

I noticed that if I changed from socket.emit to socket.send in a working program, the server fail

6条回答
  •  庸人自扰
    2020-12-02 05:00

    socket.send is implemented for compatibility with vanilla WebSocket interface. socket.emit is feature of Socket.IO only. They both do the same, but socket.emit is a bit more convenient in handling messages.

提交回复
热议问题