Emit help #4924
Emit help
#4924
-
I've gone through emit cheat sheet v3 and v4 but some things are not working properly. May be I misunderstood something. For broadcasting an event to all clients in a room except sender, I used socket.broadcast.emit('server_message', { text: `${name} joined the that🔥`, id: crypto.randomUUID() }, 'join'); But the message event is captured by every clients in every room and without room. We have io.to('room-name'); and socket.to('room-name'); I need a clarification on rooms, all-clients, only-sender, except-sender, all-clients-in-room-[..], etc. I'm using Deno as the server runtime |
Beta Was this translation helpful? Give feedback.
Answered by
darrachequesne
Jan 19, 2024
Replies: 1 comment
-
Hi!
Basically, rooms are filters that you apply when broadcasting an event. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
itsfuad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi!
io.emit()
socket.broadcast.emit()
io.to("room1").emit()
socket.to("room1").emit()
Basically, rooms are filters that you apply when broadcasting an event.