Is there way emit everyone except sender/"person who made request" inside express route #4087
-
Hi,
|
Beta Was this translation helpful? Give feedback.
Answered by
darrachequesne
Sep 16, 2021
Replies: 1 comment 1 reply
-
It should be doable with express-session: io.on("connection", (socket) => {
// join the room identified by the session ID
socket.join(socket.request.sessionID);
});
router.post("/test", (req, res) => {
// send to everyone except those in the given room
io.except(req.sessionID).emit(/* ... */);
}); For the setup, please see https://socket.io/docs/v4/faq/#usage-with-express-session (until we have a proper example with express-session) |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
JuHaNi654
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It should be doable with express-session:
For the setup, please see https://socket.io/docs/v4/faq/#usage-with-express-session (until we have a proper example with express-session)