DEV Community

Adam Aiken
Adam Aiken

Posted on

Socket.io emit, explained

https://socket.io/docs/v4/emit-cheatsheet/

sender certain client all (no sender) namespace (no sender) room (no sender)
socket.emit('msg') πŸ˜„
socket.broadcast.emit('msg') πŸ˜„
socket.to( 'room').emit('msg') πŸ˜„
io.in('room').emit('msg') πŸ˜„ πŸ˜„
io.of('namespace').emit('msg') πŸ˜„ πŸ˜„
io.to(socketId).emit('msg') πŸ˜„
io.emit('msg') πŸ˜„ πŸ˜„

Top comments (0)