Thinking Outside The Box With Durable Objects

I'm not building this yet... but just thinking about an interesting way to use Durable Objects and alarms. What do you think of using alarms to allow users to set up alarms to message the app's service worker to kick off a push notification? Besides the alarm the DO will save the custom message the user wants sent back to them. I am just thinking about ways to schedule push notifications since this is a new topic for me.
3 Replies
mackenzie
mackenzie13mo ago
I am also interested. I’m working on a DO (asked elsewhere here for help) that uses alarms, and then I’d like to potentially send a push notification. I haven’t had time to look at how to do the notification yet - so if you have hints, please share here!
RyanD
RyanD13mo ago
I do this with email and sms, so I'm assuming push wouldn't be that different
danboyle8637
danboyle8637OP13mo ago
Nice yall... thanks for responding and confirming the thought process. @mackenzie I have not set this up myself in production yet. But you need service worker and then implement the Push API (https://developer.mozilla.org/en-US/docs/Web/API/Push_API/Best_Practices) The examples aren't all that good... but it doesn't seem too hard to get setup. I think the key is to keep the service worker simple to start.
MDN Web Docs
Web Push API Notifications best practices - Web APIs | MDN
This article provides a useful summary of best practices to keep in mind when developing websites and applications that use Push Notifications for user engagement.
Want results from more Discord servers?
Add your server