Emit data only to local users when using redis adapter #5186
-
Hello, is there a method to send data exclusively to the users on the current server while using a Redis adapter? From my understanding, if I emit data, it will be sent to users on all servers, not just the ones connected to this server, since I’m using a Redis adapter with a cluster. I would like to have a namespace to remain 'private' to each server. Thanks |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 1 reply
-
Hi! You can use the io.local.emit("hello"); Reference: https://socket.io/docs/v4/server-api/#flag-local The event will only be forwarded to the clients connected to the current server. |
Beta Was this translation helpful? Give feedback.
Hi! You can use the
local
broadcast modifier:Reference: https://socket.io/docs/v4/server-api/#flag-local
The event will only be forwarded to the clients connected to the current server.