this post was submitted on 11 Sep 2024
1 points (100.0% liked)

NodeBB Development

0 readers
1 users here now

Stay tuned here to hear more about new releases and features of NodeBB!


This is a forum category containing topical discussion. You can start new discussions by mentioning this category.

founded 6 months ago
 

Our relationship with push notifications has been rather circuitous...

  1. First Andrew (@psychobunny) tried plain desktop notifications via the Notification API (that's the desktop notifications plugin), but notification delivery stopped when you closed your browser.
  2. Then I wrote the PushBullet plugin, but they went from free to paid and that went out the window
  3. Around that time I wrote the Firebase plugin, which was a dead end because there was no iOS support.
  4. I then wrote the ntfy plugin, which works really well, but does rely on a freemium third-party service and app (written by @binwiederhier@discuss.ntfy.sh)

Thanks to some recent discussion from @crazycells and @bh4-tech, I learned that the Push API had reached general availability across most modern browsers. In fact, this actually happened over a year ago, so compatibility should be even better.

So I set about working on yet another push notifications plugin, hopefully for the last time, and this time using the native Push API on the client-side.

To enable them, simply navigate over to the "Push Notifications" menu item in your user profile, and flip the switch.

6da06989-f902-492b-866f-14c39b34a9ca-image.png

So, let's dogfood! I de-activated the ntfy plugin on this site and activated the web-push plugin so you can try it out right now.

The plugin is in the proof-of-concept phase, so there might (read: most definitely will be) issues. Please let me know any you find here.

you are viewing a single comment's thread
view the rest of the comments
[โ€“] julian@community.nodebb.org 0 points 10 months ago (1 children)

If you do not receive any push notifications, it is likely because your browser is using an old, cached copy of the NodeBB service worker. You will have to wait for your browser to download the new service worker, or manually clear it.

Secondly, there is one specific caveat for this right now. Users on Safari currently do not use the service worker, and thus will not receive push notifications. This was due to a change in 2021 to work around a Safari bug, but I do not know at this time whether Safari has fixed the issue upstream.

[โ€“] julian@community.nodebb.org 1 points 10 months ago

I'm particularly excited about this new development because it opens the door for richer integration between NodeBB and the push notifications themselves.

With (probably) every iteration prior, when you clicked on the notification, it likely opened a new window. With direct access to the Push API and service worker, we can now accurately detect whether the site is already open (in another tab), and open it there.

In the future, we'll also be able to add in things like icons, pictures, and custom actions, right from the notification itself.

One particular nice-to-have is the ability to update notifications. Being able to merge notifications (like they already do in NodeBB) or potentially rescind notifications would be a nice step forward in usability as well.