Ezwal
Ezwal3mo ago

How to show a user as online even if they're not in a room with presence component

As the title says, I want my application to show an online and offline status for users. I also need to handle the specific case where a user is considered online even if they are in the app but not inside a specific room. How can I achieve this?
2 Replies
Convex Bot
Convex Bot3mo ago
Thanks for posting in <#1088161997662724167>. Reminder: If you have a Convex Pro account, use the Convex Dashboard to file support tickets. - Provide context: What are you trying to achieve, what is the end-user interaction, what are you seeing? (full error message, command output, etc.) - Use search.convex.dev to search Docs, Stack, and Discord all at once. - Additionally, you can post your questions in the Convex Community's <#1228095053885476985> channel to receive a response from AI. - Avoid tagging staff unless specifically instructed. Thank you!
erquhart
erquhart3mo ago
You could move usePresence into a context provider (or some other global state handler depending on how you do state management), and give it a default "room" for users that aren't in a room. If they are in a room, you could set the room name in the context so usePresence can pick up the current room.

Did you find this page helpful?