What’s the difference between io.sockets.emit and broadcast?

io.sockets.emit will send to all the clients

socket.broadcast.emit will send the message to all the other clients except the newly created connection

This Socket.IO Wiki post will help everyone reading this question:

The recent cheatsheet can also be viewed here:

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

Leave a Comment