Sometimes the seesaw of web tech is fascinating. Service workers have arrived, and beyond offline networking (read Jeremy's book) which is possibly their best feature, they can enable push notifications via the Push API.
I totally get the push (pun intended) to make that happen. There is an omnipresent sentiment that we want the web to win, as there should be in this industry. Losing on the web means losing to native apps on all the different platforms out there. Native apps aren't evil or anything — they are merely competitive and exclusionary in a way the web isn't. Making the web a viable platform for any type of "app" is a win for us and a win for humans.
One of the things native apps do well is push notifications which gives them a competitive advantage. Some developers choose native for stuff like that. But now that we actually have them on the web, there is pushback from the community and even from the browsers themselves. Firefox supports them, then rolled out a user setting to entirely block them.
We're seeing articles like Moses Kim's Don't @ me:
Push notifications are a classic example of good UX intentions gone bad because we know no bounds.
Very few people are singing the praises of push notifications. And yet! Jeremy Keith wrote up a great experiment by Sebastiaan Andeweg. Rather than an obnoxious and intrusive push notification...
Here’s what Sebastiaan wanted to investigate: what if that last step weren’t so intrusive? Here’s the alternate flow he wanted to test:
- A website prompts the user for permission to send push notifications.
- The user grants permission.
- A whole lot of complicated stuff happens behinds the scenes.
- Next time the website publishes something relevant, it fires a push message containing the details of the new URL.
- The user’s service worker receives the push message (even if the site isn’t open).
- The service worker fetches the contents of the URL provided in the push message and caches the page. Silently.
Imagine a PWA podcast app that works offline and silently receives and caches new podcasts. Sweet. Now we need a permissions model that allows for silent notifications.
Update:Here's Sebastiaan Andeweg's follow up article PushAPI without Notifications where he goes into the thinking, code, and demo behind all this.