Utility methods with multiple nodes #4395
Answered
by
darrachequesne
hossein-zare
asked this question in
Q&A
-
Hi, I'm using some of the utility methods such as io.in('room-name').disconnectSockets(); By the way, Are socket objects read-only on other servers if we use |
Beta Was this translation helpful? Give feedback.
Answered by
darrachequesne
Jun 17, 2022
Replies: 1 comment 2 replies
-
Hi! Yes, the Redis adapter is compatible with those methods.
On other servers, you'll get a object which exposes a subset of the methods of the Socket class: const sockets = await io.fetchSockets();
for (const socket of sockets) {
console.log(socket.id);
console.log(socket.handshake);
console.log(socket.rooms);
console.log(socket.data);
socket.emit(/* ... */);
socket.join(/* ... */);
socket.leave(/* ... */);
socket.disconnect(/* ... */);
} |
Beta Was this translation helpful? Give feedback.
2 replies
Answer selected by
hossein-zare
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi! Yes, the Redis adapter is compatible with those methods.
On other servers, you'll get a object which exposes a subset of the methods of the Socket class: