Sự khác biệt giữa io.sockets.emit và socket.broadcast.emit là gì? Có phải chỉ có chương trình phát sóng đó mới được phát cho mọi người NHƯNG ổ cắm gửi nó?
Có vẻ như chúng có thể được sử dụng thay thế cho nhau:
io.sockets.on('connection', function (socket) {
//these should do the same thing
io.sockets.emit('this', { receivers: 'everyone'});
socket.broadcast.emit('this', { receivers: 'everyone but socket'}); //emits to everyone but socket
socket.emit('this', { receivers: 'socket'}); //emits to socket
});