SSE Like async notification
like from scheduler to notify user something is finished or event happened i see that we don't need SSE since we already have full websocket but how to send ephemeral event to user what is best practice ?
8 Replies
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!
Write to your database when the event occurs, subscribe to the data in the client.
and then delete it i have that flow but seems excessive for ephemeral to have 2 databases writes
can you say a little bit more about what you're doing, might help get to a more adequate solution (or a better understanding of why a given solution is adequate)
i have cron/scheduler on whichs runs it generates event for some users if these users are currently using app i want them to redirect to page
Yeah, your user is subscribed to websockets, you want to use that to get the realtime redirect happening. I would say forget the fact that you're writing to the db as a part of this transaction, it's an implementation detail.
Or as it says in The Zen of Convex, "double down on the sync engine".
so what i use ?
I’m saying write your events to the db, even if ephemeral. Creating a secondary system to send events so you can avoid a write is something you can do if you like, but Convex does an amazing job accomplishing your goals if you just write minimal event data.