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

后端 未结 3 1605
逝去的感伤
逝去的感伤 2020-11-29 18:25

What\'s the difference between io.sockets.emit and socket.broadcast.emit? Is it only that broadcast emits to everyone BUT the socket that sends it?

It seems like the

3条回答
  •  感情败类
    2020-11-29 19:00

    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:

提交回复
热议问题