Clarification needed on Rooms #535
-
I have been checking the documentation and the code but I still don't have a solid concept of how they behave exactly. I have a codebase that only has at most 1 Socket per room. This is so I can easily emit messages sent to the socket.io server via an internal HTTP api to the user they are meant for (the room name is the userid and its autojoined on connect). The behavior that would fit my usecase is:
I am uncertain which of these are default behavior and which have to be manually implemented. Messages aren't produced unless a client is connected, this is moreso to conserve memory (by avoiding queueing messages that will never be recieved) and ensure consitency (to avoid race conditions) |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment
-
Hi! I recommend you to read this:
Don't hesitate if you need other clarifications. |
Beta Was this translation helpful? Give feedback.
Hi! I recommend you to read this:
https://socket.io/docs/v4/rooms/.
This may help you to better understand rooms.
To answer your three questions:
get_socket
and emitting from it or storing it in a map of pending messages to send on the socket connection.Don't hesitate if you need other clarifications.