iOS 16 web push notifications in 2023

I’m grateful for you providing more detailed info on this!

Do you or does anyone else know how this will impact Discourse instances? I assume it will mean that when someone saves a website to the home screen, then it will allow the user to receive notifications from that Discourse PWA, is that true?

Also, will this allow DiscourseHub to send iOS push notifications to all of the Discourse instances within it?

1 Like

No, this feature has nothing to do with installing to the home screen or “PWAs.”

“PWA” is sort of a marketing term invented by developers at Google; the term refers to a bundle of features:

  1. add to home screen (A2HS)
  2. offline support, so the site/app keeps working when you’re offline
  3. native-like features (features that used to be exclusive to native apps), including push, bluetooth, background fetch, etc.

But the features have nothing inherently to do with each other. You can have any one of those features without any of the others.

  • You can add any web page to your home screen. The web page doesn’t have to have offline support or native-like features to A2HS. (It’s really just adding a bookmark to your home screen; that’s all A2HS does.)
  • You can enable offline support for your web site regardless of whether you use A2HS or not.
  • There are no native-like features that require you to use A2HS or to use offline support. WebBluetooth works on any web page, as long as the user accepts a “permissions” dialog; you don’t have to A2HS to turn it on.

Today, in Google Chrome and in today’s shipping version of macOS Safari 15, web sites can pop-up a little request dialog, asking permission to push notifications. (You have to do it in a “click” handler or a response to a similar “user gesture” like dragging or swiping.) You’ve probably seen those pop-ups on news sites from time to time.

Apple’s blog post seems to indicate that nothing will change about the permission prompt in Safari 16:

Users opt into notifications by first indicating interest through a user gesture — such as clicking a button. Then, they’ll be prompted to give permission for your site or app to send notifications.

This question is confusing. That’s what Discourse Hub already does today.

1 Like

I think maybe there was something wrong with my notifications settings on my iPhone where they weren’t arriving:

Ah nice! So people could still get the notifications without A2HS, sounds great, thank you.

I was under the impression that iOS notifications in Discourse Hub only worked for Discourse instances hosted by the Discourse team as per the message below. Has this changed?

4 Likes

As the thread you linked to explains, Discourse Hub can push notifications for any Discourse site, even ones not hosted by the Discourse team, but it only pushes live (instant) notifications for sites hosted by the Discourse team. If you add a non-hosted site to Discourse Hub, you’ll get notifications, but at a slower schedule.

Nonetheless, I don’t think that’s what the question is asking about, but I may have misunderstood:

Discourse Hub can already send iOS push notifications to from all of the Discourse instances within it. Non-hosted sites send notifications more slowly, but they do send notifications.

3 Likes

Ahh I was indeed hoping that self-hosted sites would send be able to send immediate notifications. Maybe the delay in the notifications was what confused me about whether they were currently being sent or not.

That being said, I’m excited that iOS 16 should enable the immediate ones for self-hosted Discourse sites :tada:

1 Like

Thanks for the clarification. I am mainly interested in live iOS push notifications, not notifications fetched via polling.

1 Like

“WKWebView” is Apple’s API for embedding a web browser in a native app; Discourse Hub uses WKWebView. As far as I know, today’s existing proprietary macOS Safari 15 push notifications don’t work in a WKWebView on macOS.

Apple makes some native-like features available only in the Safari app, not in a WKWebView, and sometimes not even in web pages saved to the home screen, which technically each run in a separate “Web.app” process on iOS.

We don’t yet know whether the new standard Push API will work in a WKWebView, (so we don’t know whether they’ll work in Discourse Hub), and we certainly don’t know whether Push API will work in a WKWebView on iOS, which isn’t even shipping in 2022.

But, a few more details are supposed to be available at tomorrow’s presentation.

FWIW, it’s typical for Apple Evangelists to refuse to answer further questions about native-like features on the web publicly.

Consider this question posed on Twitter:

Apple has been answering Maximiliano’s questions throughout the day, but, uh, for some reason, just this question has gone unanswered! :grimacing:

5 Likes

Oh goodness, I love this level of detail, thank you for writing it out. Here’s to hoping it will work on the WKWebView in iOS and homescreen apps :crossed_fingers:t2:

I’m glad to see that I wasn’t the only one watching that keynote. :wink:

I’m not sure why it won’t debut with the first release of iOS 16, but whatever…

Wasn’t that already available in macOS? I’ve been able to receive able to receive Safari push notifications from MacRumors for years now. Maybe they were using a workaround of some sort? :thinking:

2 Likes

As I said in my earlier post:

1 Like

Ah, sorry. I wasn’t entirely sure what you meant by that. :see_no_evil:

1 Like

There was very little detail in today’s video. Meet Web Push for Safari - WWDC22 - Videos - Apple Developer

WebKit has a blog post up today.

There’s a little more detail available here.
https://developer.apple.com/documentation/usernotifications/sending_web_push_notifications_in_safari_and_other_browsers

At the Safari WWDC lounge, a user “John” asked a question, “Will web push work in WKWebView instances?” The answer from “Brady E” at Apple was:

On macOS Ventura, Web Push is only supported in Safari 16.

John followed up: “what about iOS/iPadOS?” to which Brady replied, “Look for iOS/iPadOS support in 2023.” So, they’re not answering any questions today about iOS support.

It seems extremely unlikely to me that Web Push notifications will work in a WKWebView in 2023, especially on iOS, so I expect that Safari Web Push will have no direct benefit to Discourse Hub.

But, of course, the Discourse Hub app will be much less important when Safari Web Push lands.

6 Likes

Thank you for following this with Apple and for writing a follow-up to this here :pray:t2:

There are some other benefits to the Discourse Hub application.

You’re mostly correct though. It’ll become partially obsolete soon enough. I wonder if CDCK will ditch it altogether… :thinking:

1 Like

Its About Time GIFs | Tenor

BTW, There are no plans on ditching the mobile app, it’s still very useful to be able to aggregate all of your discourse sites and notifications together in one place, separately from receiving real-time notifications

3 Likes

Would it make sense to bring Discourse Hub to the web as a PWA?

4 Likes

That’s unfortunately not something currently on our roadmap, but it’s something I personally would love to see, it’s an great idea :slight_smile:

7 Likes

Me too. Especially since non-push notifications flat out don’t work 95% of the time.

Really this whole topic is about push notifications, which you simply can’t get on iOS with self-hosted Discourse without creating a separate iOS app, which then might not be accepted into the App Store.

2 Likes

Oh, I’m glad to hear it’s not on the chopping block! @jimkleiber made a good point about that.

1 Like