node.js - What is the purpose of `socket.broadcast.to(param)` in socketio -


while i'm learning node.js, confronted example write chat system.

somewhere in code there's following line:

socket.broadcast     .to(message.room)     .emit('message', themessage); 

i don't understand to function doing. also, didn't find clue @ client side code. happens if code has not to(message.room) part?

socket.broadcast.to broadcasts sockets in given room, except socket on called.

for more details : http://socket.io/docs/server-api/#socket#to(room:string):socket


Comments

Popular posts from this blog

twig - Using Twigbridge in a Laravel 5.1 Package -

firemonkey - How do I make a beep sound in Android using Delphi and the API? -

jdbc - Not able to establish database connection in eclipse -