XF 2.1 Push notifications

Welcome to the first of our "Have you seen...?" series for XenForo 2.1. We've got a lot to show you over the course of the next few weeks so you may well be hearing from us quite frequently... To ensure you're kept up to date, we strongly recommend clicking the "Watch forum" link here and enabling email notifications if you haven't done so already 🙂

But first...

The first thing that we should announce before we get started is something which we have talked about over the last year which is related to the minimum server requirements of XenForo 2.1. XenForo 2.0 currently requires a minimum of PHP 5.4, but with XenForo 2.1 we are increasing this to a minimum of PHP 5.6. Now, PHP 5.6 is still pretty old by today's standards, so you may be interested to understand why we have settled on that as our new minimum PHP version.

The answer is fairly simple, in that we are essentially trying to strike a balance between the features in PHP that we need to use, the requirements of third-party packages that we include with XenForo, and ultimately the common PHP versions that customers are using on their servers. Since XF 2.0.2 we have been keeping track of this, and these are the current results:

1539019830210.webp

To the one customer who is running PHP 7.3 Alpha I sincerely hope you are doing so in a test environment 😉
As you can see, it seems like a fairly safe bet for us to consider leaving behind PHP 5.4 and PHP 5.5 as that amounts to only 6.5% of the total customer base. One could argue that PHP 7.0 would be an ok target too as the total PHP 7.x usage is at 55.3% but leaving behind a total of 44.7% of the total customer base seems unreasonable at this point. We'd strongly recommend everyone consider upgrading to PHP 7.2 as soon as possible.

That all said, we have mentioned previously that there is one feature which will require a minimum version of PHP 7.1 to use...

Push it real good...

To view this content we will need your consent to set third party cookies.
For more detailed information, see our cookies page.
Sorry, I couldn't help myself! 🙂

That's right, we're kicking off our XF 2.1 series of HYS threads by announcing that our most popular suggestion is implemented! Let's first look at how to set it up.

1539022286792.webp

If the above browser/device requirements are frustrating then please direct your complaints to @WebKit on Twitter!

So, yes, first and foremost, you will need PHP 7.1 to enable this functionality. This enabled us to implement the functionality in a way that is compatible with as many browsers as possible, including Microsoft Edge on Android and Windows.

In addition to this, your site must be running over HTTPS with a valid SSL certificate, and you must have support for the GMP extension.

Unfortunately for reasons beyond our control (read: it's Apple's fault) the list of supported devices/browsers notably exclude Safari on macOS and any iOS-based browser. This functionality is made possible by making use of a number of APIs including the Push API and Notification API which most browsers support already.

On supported devices, the process looks something like this:

21push1.gif

You can also see that, just like alerts, we have provided a mechanism for you to be able to opt out of receiving certain push notifications. You may want to get forum alerts for everything, but only be notified by your browser for the things you find important.

The content of a push notification will be a slightly stripped down version of the default alert template. A brief note for developers; although there is code which will automatically convert HTML to a text-only version of the notification, the preferred method would be to create specific push template for each content type and action, and these will look similar to this:
HTML:
{{ phrase('x_quoted_your_post_in_thread_y', {
   'name': $user.username ?: $alert.username,
   'title': prefix('thread', $content.Thread, 'plain') . $content.Thread.title
}) }}
<push:url>{{ link('canonical:posts', $content) }}</push:url>

As you would expect with push notifications, you do not necessarily need to be viewing the forum when the notification is received, nor does the browser even need to be active, as demonstrated here:

21push2.gif

Naturally, clicking on the notification will take you straight to the content.


Alert read marking

Going straight to the content from wherever you are on your device is certainly convenient, but given that push notifications essentially represent forum alerts, it would be somewhat inconvenient to have to mark those as read too.

Therefore when you now visit content which you have previously been alerted to, the corresponding alert(s) will now be automatically marked as read.


"But I have an Apple device, will you support push notifications another way...?"

Unfortunately, this is unlikely. Although Apple devices represent a significant number of mobile users, the current approach other browser vendors are taking is standardised (meaning Apple devices could be nearly automatically supported in the future), free and seamlessly integrated with your browser. Any other approach, be that a separate app, or a third party service would, frankly, be a sub-par (and potentially expensive!) experience.

The overall solution is simple, but it is down to Apple/WebKit to take on board and implement. According to the WebKit Feature Status page, if there are any features missing you can reach out to @webkit on Twitter or contact the webkit-help mailing list. Consider doing that today to help them understand why push notifications are important for your forum 🙂


And, sadly, that brings the first HYS for XF 2.1 to an end! But don't worry - as mentioned earlier we have lots more to get through 🙂 And we may well see you for that fairly soon 😉
 
Last edited:
Has a list of supported devices been determined? For instance, a user like myself with an "older" iPhone 6s with Chrome loaded, I see a button that says "push notifications not supported" in my preferences here on this site. That must mean my device is not supported. Anyone know the cut off for supported devices yet?
 
Iphones don't support it at all.
So it's just iPhones they don't work on, but they work on Macbook Pro laptops?
An FYI here, macOS users can receive push notifications, they just can't do so with Safari. They work perfectly fine with Chrome and Firefox. I know as I use both these browsers on my MacBook Pro. This might be useful information to pass on to your members. Maybe not ideal for some to switch browsers but it is a solution for them.
 
This is a fairly disturbing chart of browser support:

Can I Use push-api? Data on support for the push-api feature across the major browsers from caniuse.com.

You can essentially disregard IE (because it has been superseded by Edge). You can disregard Android browser (because it has been superseded by Chrome). You can disregard Opera Mini (because it's Opera Mini...)

That just leaves Safari (macOS) and iOS Safari (any and all browsers on iOS).

Totally shoddy state of affairs. But, hey, at least Apple are doing innovating in important areas such as launching their own credit card and encouraging their customers to get into crippling debt. That's far more important.

I'm beginning to think the simple fact of it is: they cannot monetise push notifications - so why bother?
 
This is a fairly disturbing chart of browser support:

Can I Use push-api? Data on support for the push-api feature across the major browsers from caniuse.com.

You can essentially disregard IE (because it has been superseded by Edge). You can disregard Android browser (because it has been superseded by Chrome). You can disregard Opera Mini (because it's Opera Mini...)

That just leaves Safari (macOS) and iOS Safari (any and all browsers on iOS).

Totally shoddy state of affairs. But, hey, at least Apple are doing innovating in important areas such as launching their own credit card and encouraging their customers to get into crippling debt. That's far more important.

I'm beginning to think the simple fact of it is: they cannot monetise push notifications - so why bother?

Which is why they should create a service to allow websites to enroll and push for only 0.0001 centers per notification.

Minimum fees may apply. No valid in Germany or the State of California.
 
@Chris D To be fair, there is a perfectly functional push system on macOS. It just doesn't conform to the push API. But I agree on the main point, that iOS should have push and Apple is the only one withholding it.

At the same time, think about how many developers are desperate to get out of Apple's app review process, and the only feature they don't have is push. The app store more would take a bigger hit than most would expect.
 
Frankly, I don't care how functional the macOS one is. It's unreachable for most because of the (relative) technical complexity of setting it up and that it requires you to enrol in the Apple developer programme.

There is no defence at this point for Apple withholding free and well supported specifications from either macOS or iOS.
 
That's absolute rubbish. I've implemented it, and it's not terribly complex. The problem is the $99 enrollment to the developer program and the lack of iOS support, no better no worse. They have a defense. It's called monopoly and money.
 
Jeez... obviously it's not complex for you or for me which is why I said "relative complexity". However, there exists in the world people who are not software developers. And clearly the process for them is slightly more complex than clicking "Enable push notifications" in the Admin CP.
 
That's absolute rubbish. I've implemented it, and it's not terribly complex. The problem is the $99 enrollment to the developer program and the lack of iOS support, no better no worse. They have a defense. It's called monopoly and money.
Not everybody has to play their game. Perhaps xenForo has decided the game isn't worth playing.
 
Not everybody has to play their game. Perhaps xenForo has decided the game isn't worth playing.
Chris has been clear on his position on this for some time, IIRC he thought web push wasn't worth it at all because of Apple's decision and the resulting math. I understand why that is. At the time I think I was launching an XF web push add-on.

A year or whatever amount of time later, IMO it's not worth implementing, maybe we've switched sides somewhat. But our reasons are different. Relentless push prompts upon opening websites you aren't logged into turned people off (OneSignal).

macOS (desktop) has push, not to be confused with iOS (mobile). There are Packagist libraries for macOS, just like the library XF uses to implement Web Push. It is not hard for an admin, but it costs $99/year and does not work on iOS.

If you have an app store account already for some unrelated reason, then the additional cost isn't there.
 
It is not hard for an admin
You might be underestimating users' ability to heck things up.

If you see a setting like "If you have downloaded the GeoIP database to your server, enter the full path to the GeoLite2-City.mmdb file here." that might be the most obvious thing in the world for you. If I had a dollar for every support ticket I received stating they could not work out how to actually do that, I'd be buying a shiny new iMac Pro.

That does not mean those users are stupid. It means they have a different set of skills, that does not involve extensive knowledge of how web server paths work.

If you legitimately cannot tell the difference between ticking a single "Enable push notifications" box in the AdminCP and creating an Apple developer account, filling out the various forms they require to set up a developer profile, paying for it, downloading & installing the certificate on the server, [...] then you should try to look at it from the perspective of someone who does not know the first thing about the web or server management.

---
Like I said previously in this thread, I believe the main thing holding back Web Push support is Apple wanting a one-stop shop for managing notifications on iOS. It's easy to do for apps, since you can require apps to register for certain APIs that add entries to the "Notifications" page in iOS, but how do you add a web notification to that page? 🤔

I don't think Apple wants you to have to go into the Safari settings on iOS to manage notifications, so they would need to work out a way to have ServiceWorker Push API registrations show up in a section under Notifications. Perhaps there are technical reasons for why that's not as easy as it sounds, or perhaps you lot are right and they are desperately trying to force people into creating apps.

Hopefully we'll see something in regards to this at WWDC for iOS 13. I've been waiting for notification sync (á la Pushbullet) to macOS for a number of years now, maybe this year's the year we all get our Xmas presents early! :P
 
You might be underestimating users' ability to heck things up.
I am not estimating anything. We had this in production with several customers. IIRC, those who wanted to use their own account's push package just had to enter their Team ID, package name, and upload their key.

The way we approached the $99 issue was to use a shared package (our key, and our push server on the cloud) so no app store account was required. THAT was complex (for us), and had it's share of bugs (for admins) before it was rock solid.

But, a shared system is a different discussion.
 
Unfortunately, I have more iPhone device users than any other device - including desktop. I'm guessing I'm not the only one. Hopefully something can be done to address this at some point. I suspect I'll eventually have to invest in getting an app developed to get traditional push notifications for our iOS users. I'd bet our traffic and participation would surge once we got it implemented.
 
Last edited:
Plus iOS users are worth more and consistently spend more money in app.

After watching the recent Apple Keynote it seems Apple are going to milk users for every service they possibly can. Reading, video, audio, as many daily monetary transactions as they can, on or off their computer or phone. I doubt the control of push will ever fall out of that remit when it may affect users experience with those services.

I'm beginning to think the simple fact of it is: they cannot monetise push notifications - so why bother?

It's absolutely party this. Although I think it's not just the monetisation of the notifications themselves. But the control of the entire AppleOS ecosystem experience.

Push notifications pull people out of games, out of video watching, out of reading new articles, out of all that attention of their customers that they're trying so hard to get control of. They're not going to let random websites send push notifications to users easily through Safari any time soon without having some say or benefit from it, and not without the OS having proper granular control over them in terms of intrusiveness, as native push notification have.

I'd bet that any kind of basic Safari based iOS web push is farther away than ever now and they'll continue reserve the deeply integrated rich, interactive and customisable experience to native apps only for as long as they can.

I really hope I'm wrong. But I'm not confident in any kind of useful web push implementation coming to iOS any time in the next year or two, or even until Apple feel they're forced to in some way due to some external pressure, or until they figure out some kind of cross platform management system for anyone in their ecosystem. Notification fatigue and overload is such an issue these days that they will need to address it before they unveil their solution. One that manages the delivery from desktop to mobile so users don't get slammed with multiple notifications for one post 'like' on a random website they're registered on. Apple are the kings of refining the experience until it's perfect. Having a site that allows desktop browser notifications and duplicate mobile notifications without any kind of consideration or 'talking' to each other to decide if you're at the computer or not, or if it's urgent or not to deliver that notification to specific device, is not like Apple. They're not going to let people feel like they're getting spammed by notifications if they can control, fix and refine that experience.

They're going to continue to tell people to make native apps and most devs/apps/platforms/solutions/communities to handle that, and they will do what Apple says and pay up so that their app can stay relevant and utilise the best native features and then refine their app to deliver that smart cross platform experience.

I admire the XF approach to the open standards, and get that they're trying to make the best, most open cross platform solution possible and I think that's awesome, but Apple doesn't care, because they know it's not the best possible experience (they feel that no experience, or lack of a decent web push option is better than a bad experience). They know the users of apps on their platform spend more money and they don't have a choice and they can make the experience better if they're in full control, so they will continue to ensure they're getting paid by the devs that submit apps to that platform to get their cut, and reserve the best native iOS features for those devs and their users until they have a great, smart cross platform/web integrated solution that they can roll out to everyone.
 
Last edited:
Plus iOS users are worth more and consistently spend more money in app.

After watching the recent Apple Keynote it seems Apple are going to milk users for every service they possibly can. Reading, video, audio, as many daily monetary transactions as they can, on or off their computer or phone. I doubt the control of push will ever fall out of that remit when it may affect users experience with those services.



It's absolutely party this. Although I think it's not just the monetisation of the notifications themselves. But the control of the entire AppleOS ecosystem experience.

Push notifications pull people out of games, out of video watching, out of reading new articles, out of all that attention of their customers that they're trying so hard to get control of. They're not going to let random websites send push notifications to users easily through Safari any time soon without having some say or benefit from it, and not without the OS having proper granular control over them in terms of intrusiveness, as native push notification have.

I'd bet that any kind of basic Safari based iOS web push is farther away than ever now and they'll continue reserve the deeply integrated rich, interactive and customisable experience to native apps only for as long as they can.

I really hope I'm wrong. But I'm not confident in any kind of useful web push implementation coming to iOS any time in the next year or two, or even until Apple feel they're forced to in some way due to some external pressure, or until they figure out some kind of cross platform management system for anyone in their ecosystem. Notification fatigue and overload is such an issue these days that they will need to address it before they unveil their solution. One that manages the delivery from desktop to mobile so users don't get slammed with multiple notifications for one post 'like' on a random website they're registered on. Apple are the kings of refining the experience until it's perfect. Having a site that allows desktop browser notifications and duplicate mobile notifications without any kind of consideration or 'talking' to each other to decide if you're at the computer or not, or if it's urgent or not to deliver that notification to specific device, is not like Apple. They're not going to let people feel like they're getting spammed by notifications if they can control, fix and refine that experience.

They're going to continue to tell people to make native apps and most devs/apps/platforms/solutions/communities to handle that, and they will do what Apple says and pay up so that their app can stay relevant and utilise the best native features and then refine their app to deliver that smart cross platform experience.

I admire the XF approach to the open standards, and get that they're trying to make the best, most open cross platform solution possible and I think that's awesome, but Apple doesn't care, because they know it's not the best possible experience (they feel that no experience, or lack of a decent web push option is better than a bad experience). They know the users of apps on their platform spend more money and they don't have a choice and they can make the experience better if they're in full control, so they will continue to ensure they're getting paid by the devs that submit apps to that platform to get their cut, and reserve the best native iOS features for those devs and their users until they have a great, smart cross platform/web integrated solution that they can roll out to everyone.
I think you're spot on with this. After reading the Steve Jobs biography this makes complete sense - Apple has always made it a point to control their environment/ecosystem. I wouldn't be surprised if they never opened it up for push notifications because of all the reasons you pointed out. It's not about monetizing the actual notifications, it's about how those notifications could negatively impact their environment. They wouldn't allow that to happen.
 
Top Bottom