Are there any examples on how to implement web notifications?

If, for example, a User A leaves a comment on User B's photo, how do I show a notification to User B? I would need to know if User B has seen the comment or not. How would I check that? I'm assuming I would need a Notifications Table in my database with a one-to-many relationship. Where each user would have one notification table with many notifications. The notifications would have to get deleted automatically once the user sees the new comment. Are there any examples that show how to implement such a system? Thank you!!
2 Replies
NotLuksus
NotLuksus2y ago
I've implemented it in pretty much that exact way in a recent project, I made it so the user had to confirm to delete the notifications, because in my case they might be useful to check at a later date in time. So it basically: 1. Condition A is met 2. Create Notification with a relation to the user, store all the necessary information for that notification e.g. what condition was met 3. Display the user all notifications that have a relation to them 4. Delete the notifications selected by the user I can't really share any code right now, but I think with just reading the prisma docs, or having basic knowledge about sql you should be good to go.
Amos
Amos2y ago
Use something like https://novu.co/ or https://knock.app/
Want results from more Discord servers?
Add your server