Skip to content

Socket#to(room:String):Socket Socket#in(room:String):Socket #43

@smart--petea

Description

@smart--petea

Sets a modifier for a subsequent event emission that the event will only be broadcasterd to sockets that have joined the given room.

To emit to multiple rooms, you can call to several times.

var io = require('socket.io')();
io.on('connection', function(socket) {
  socket.to('others').emit('an event', { some: 'data'});
});

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions