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

后端 未结 6 1932
日久生厌
日久生厌 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 04:48

    Simple and precise (Source: Socket.IO google group):

    socket.emit allows you to emit custom events on the server and client

    socket.send sends messages which are received with the 'message' event

提交回复
热议问题