You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Emit cheatsheet page says that it's possible to send an event to all clients like this:
// sending to all connected clientsio.emit('an event sent to all connected clients');
However, according to this documentation page, io is an alias for io.sockets (source code; it seems this isn't mentioned in the server API documentation) which itself (according to this page and source code) is an alias for io.of('/') (assuming io is a Socket.IO server). I tested this, and io.emit(...) indeed behaves just like io.of('/').emit(...).
It seems that sending an event to all clients in all namespaces is not even possible (except if you manually send it to every namespace you're interested in with multiple io.of(...).emit(...) calls).
The following example from the cheatsheet is also likely wrong, but I haven't tested it:
// sending to all clients on this node (when using multiple nodes)io.local.emit('hi','my lovely babies');
My guess is that it will send an event to every cilent on the default namespace of the current node (source code: it only sets a modifier on the default namespace).
The text was updated successfully, but these errors were encountered:
The Emit cheatsheet page says that it's possible to send an event to all clients like this:
However, according to this documentation page,
io
is an alias forio.sockets
(source code; it seems this isn't mentioned in the server API documentation) which itself (according to this page and source code) is an alias forio.of('/')
(assumingio
is a Socket.IO server). I tested this, andio.emit(...)
indeed behaves just likeio.of('/').emit(...)
.It seems that sending an event to all clients in all namespaces is not even possible (except if you manually send it to every namespace you're interested in with multiple
io.of(...).emit(...)
calls).The following example from the cheatsheet is also likely wrong, but I haven't tested it:
My guess is that it will send an event to every cilent on the default namespace of the current node (source code: it only sets a modifier on the default namespace).
The text was updated successfully, but these errors were encountered: