Based from the official site of socket.io http://socket.io/#how-to-use, I can't find any terminologies.
What are the differences between socket.emit
, socket.on
, and socket.send
? Can't find articles which differentiate between these things. I am currently developing a real-time application.
Asked
Active
Viewed 9,971 times
10

GadaaDhaariGeek
- 971
- 1
- 14
- 33

Orvyl
- 2,635
- 6
- 31
- 47
-
hello @Orvyl i want this question more , like socket.broadcast, socket.join , socket.in .... please – Rajanboy Feb 06 '22 at 15:37
2 Answers
16
socket.emit
- This method is responsible for sending messages.
socket.on
- This method is responsible for listening for incoming messages.
socket.end
- This is the first time I'm hearing such a method. I am not really sure that it exists.

DifferentPseudonym
- 1,004
- 1
- 12
- 28

Sergey Rura
- 234
- 2
- 3
-
1Socket.send should be seen as a low-level api (for custom protocols development, or cases where maximum messages per second speed is crucial), and Socket.emit a higher-level interface (for app development). – Sergey Rura May 18 '13 at 09:39
-
1
socket.emit
Creates events to send datasocket.on
listens for specific events to collect datasocket.send
Sends events of the namemessage

Jake
- 97
- 1
- 9