Socket#in(room:String):Socket
Sets a modifier for a subsequent event emission that the event will only be broadcasted to sockets that have joined the given room
.
To emit to multiple rooms, you can call to
several times.
1 2 3 4 | var io = require( 'socket.io' )(); io.on( 'connection' , function (socket){ socket.to( 'others' ).emit( 'an event' , { some: 'data' }); }); |
Please login to continue.