Implementing notifications while user is offline


#1

I originally though using Subscriptions was the solution to this question, but am learning those are really used for detecting changes immediately, possibly only while the user is logged in (although I’m still unclear whether the websocket is a single connection between the client and server or if it is a unique connection between user and server and therefore only works while the user is logged in), so it may not be the best solution for detecting changes on refetch. Most of them wouldn’t need to be immediately fetched, after all.

So, if I want a user to receive a notification when something is added to the database, and that user is not online when the change happens, what is the best way to present a list of the changes when they log back in, and make them go away when they are seen? I’d like to implement badge notifications on the frontend with next.js and React/Apollo.

I’ve extensively searched topics regarding push notifications and Apollo, but only Subscription tutorials come up. I know this is in part an Apollo question but since I am also using Prisma and have no idea how much involvement it would have, I wanted to ask here as well. Any leads in the right direction would be appreciated!