Create pwa_webpush submodule to manage push notifications

Created on 24 July 2019, about 5 years ago
Updated 21 August 2024, about 1 month ago

Push notifications:

  • Create the module taking D7 version as reference.
  • Create a pwa_webpush_subscription table to hold the registration information and have the URL needed to send the push notification. Do not store extra data like the user agent, ip, etc. Privacy first. Declare it to views and create the default list with a view. (as far as datastructure is concerned, make the expired column NULL by default)
  • Have a single function call the WebPush library to send the message (in D7 it's pwa_webpush_send() but it's not very good)
  • Create a "push" serviceworker plugin with the relevant configuration
  • Make a rules action to send a notification
  • Make the route pwa/webpush/subscription/% D9 compatible and implement the different callbacks to create/expire a subscription.
  • Generate VAPID keys on install if they are not found. Add instructions in the README to explain how to generate the keys and add them to settings.local.php before module installation.
  • Define a block that can display a button to register notifications

Original report by zenimagine

Hi, I have the Message and Flag module on my site.

A user can flag a group or store and receive notifications in his private news feed.

When an event occurs in one of its entities, a message is automatically created.

This works great for my site but it lacks the PUSH notfications essential in 2019.

With this module, will you be able to generate PUSH notifications?

This is one of the features of PWA.

โœจ Feature request
Status

Needs work

Version

2.0

Component

Code

Created by

๐Ÿ‡ซ๐Ÿ‡ทFrance zenimagine

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    As in #51 this was merged into 2.x - should this issue be closed @AlexBorsody?

  • Assigned to AlexBorsody
  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany rupl

    Just chiming in to say that webkit is joining the 2010s, adding Web Push as of iOS 16.4

    https://webkit.org/blog/13878/web-push-for-web-apps-on-ios-and-ipados/

  • ๐Ÿ‡จ๐Ÿ‡ฆCanada ambient.impact Toronto

    As seems to be the norm for Apple nowadays, they seem to grudgingly implement these things because everyone else has, not because they want to. I've spoken to some of the old guard engineers at Apple, and let me tell you, some of them are truly painful due to how much disdain they have towards the web platform. I was literally told that they couldn't stand the fact that some websites have bad UX so they wanted to enforce their UI on everyone, but the web wouldn't let them, which sounds a lot like something they should talk to a therapist about rather than putting it on their millions of users. I'm not saying that to make light of mental illness, by the way - I've seen multiple therapists over the years.

    I'm my "Why the web?" essay/manifesto, I conclude with this excellent quote by Mathias Schรคfer that sums it up:

    There are several relevant browsers in numerous versions running on different operating systems on devices with different hardware abilities, internet connectivity, etc. The fact that the web client is not under their control maddens developers from other domains. They see the web as the most hostile software runtime environment. They understand the diversity of web clients as a weakness.

    Proponents of the web counter that this heterogeneity and inconsistency is in fact a strength of the web. The web is open, it is everywhere, it has a low access threshold. The web is adaptive and keeps on absorbing new technologies and fields of applications. No other software environment so far has demonstrated this degree of flexibility.

  • ๐Ÿ‡ซ๐Ÿ‡ทFrance GuillaumeDuveau Toulouse

    @Anybody it was removed a few days later https://git.drupalcode.org/project/pwa/-/commit/6f8359399b41bc78cd83ae42...

    Nothing regarding web push notifications has been commited on 2.x since then.

  • Status changed to Active over 1 year ago
  • ๐Ÿ‡ซ๐Ÿ‡ทFrance GuillaumeDuveau Toulouse

    Changing to active. It's more than "needs work", there's nothing ATM.

  • Issue was unassigned.
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    As of #60 this needs a new MR against 2.x-dev

  • Status changed to Needs work over 1 year ago
  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica

    Someone should please create a MR based on the work and discussions above for review. I'd still like to add this as submodule, but don't have the time to do it myself.

  • ๐Ÿ‡ฉ๐Ÿ‡ชGermany Anybody Porta Westfalica
  • ๐Ÿ‡ฎ๐Ÿ‡นItaly kopeboy Milan

    This would be a killer feature!
    Please consider ECA instead of Rules integration.

  • ๐Ÿ‡ณ๐Ÿ‡ฑNetherlands nk_

    Not sure if entirely relevant to this issue, apologies in case... I've built a module which implements Web Push library for PHP, DANSE and Push framework, tailored and tested - a single case scenario though - to work with PWA. Here: https://www.drupal.org/project/pf_notifications โ†’

Production build 0.71.5 2024