orvyl orvyl - 4 months ago 15
Node.js Question

socket.io - socket.emit, socket.on, socket.send

Base from the official site of socket.io http://socket.io/#how-to-use, I cant find any terminologies.
What are the difference between

socket.emit
,
socket.on
, and
socket.end
? Can't find articles which differentiate these things. Im currently developing a real-time application.

Answer

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.

Comments