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 failed to receive the message, although I don't understand why.
I also noticed that in my program if I changed from socket.emit
to socket.send
, the server receives a message, but it seems to receive it multiple times. When I use console.log()
to see what the server received, it shows something different from when I use socket.emit
.
Why this behavior? How do you know when to use socket.emit
or socket.send
?