While I'm learning Node.js, I confronted an example to write a chat system.
Somewhere in the code there's following line:
socket.broadcast
.to(message.room)
.emit('message', theMessage);
I don't understand what the to
function is doing. Also, I didn't find any clue at the client side code. What happens if the code has not to(message.room)
part?