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.png

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.png

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:
In the first post, it says:

"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"
Did you try?
I just tried here and no push notif when chrome is totally close.
 
What do you mean by "totally closed" though?

If you mean that you've pushed the home button and launched some other app, but Chrome is running in the background, and there are no notifications, then that would be unexpected.

If you mean that you've physically ended the process and shut down the browser and that prevents notifications coming through, that is expected. There needs to be something running in the background otherwise there's nothing to receive the notification.
 
It may vary from browser to browser and OS to OS (such as if the browser has any background services that continue to run) but for the most part if you kill the app like that, you kill its service worker, so you kill its chance to process push notifications.
 
Push notifications work on any device that supports them. This is essentially any browser on Windows, any browser on macOS (except Safari), any browser on Android and no browsers at all on iOS because Apple/WebKit are becoming the new Internet Explorer for the modern day.
I'm sorry, but while I deeply respect you and all the devs here I can't agree with the way this has been implemented, nor with the attitude. We as forum admins need to cater to our customers. We're a 330,000+ community where 25% of the traffic comes from iOS and another 20% from MacOS. Your Pushover mod works great on 1.5 and our users love it. In the most stereotypical IT form, it's a shame that the focus has been to mock Apple instead of – again – offering a solution for forum owners and their customers to have full functionallity – just like the Pushover mod did. I couldn't care less about iOS or Android or whatever OS, I just think as a business model it's absolutely ridiculous for me to offer a functionality to half of my customers and blame Apple for it – which is exactly what you're doing.
 
Last edited:
That's because it is indeed Apple's fault...

They have so far actively avoided (for whatever reason) and decided to deliberately ignore the same browser APIs and specifications that almost all other browser vendors have implemented.

I'm glad your users have enjoyed using the Pushover add-on, but unfortunately that implementation would fly even less well with the majority of our customers and would be an even worse business model for them.

Exactly how many of the 350,000 users have spent $4.99 on a license (per device!) to use Pushover on their devices? The most common piece of feedback I had about that add-on was "none of my users will pay that". I'm fairly certain that would be representative of the majority of our customers.

Another huge problem for the majority of our customers with Pushover is the cost for admins too.
On the first of each month at midnight Central Time, all application usage limits reset back to the free allowance of 7,500 messages. Once an application has sent 7,500 messages in a month, it will receive an error from our API and will no longer be able to send messages until the first of the next month when the allowance resets.

For high-volume applications that need to send more than 7,500 messages per month, additional capacity can be purchased from our website (10,000 for $50.00 USD, 25,000 for $115.00 USD, 50,000 for $200.00 USD, 100,000 for $300.00 USD, 500,000 for $1000.00 USD).
These are costs that our customers or their users should never have to pay and with the current implementation, they don't. As an Apple user, believe me, there is nothing I want more than for Apple to start supporting this. It's a bone of contention of mine that, as petty as it sounds, may well see me purchase my first Android device after nearly 10 years of being an iPhone user.

It also shouldn't come down to us to fill a gap that Apple has left with potentially expensive or lacklustre workarounds. With a single implementation in XenForo we're able to support the vast majority of mobile and desktop browsers combined - somewhere in the 75% region. Once Apple bridge this gap themselves - and there is no reason at all why they couldn't - that will be 100% from day one (depending on how much they deviate from the specification).
 
but unfortunately that implementation would fly even less well with the majority of our customers and would be an even worse business model for them.
Maybe that's because they're not thinking of it as a business model.
Exactly how many of the 350,000 users have spent $4.99 on a license (per device!) to use Pushover on their devices? The most common piece of feedback I had about that add-on was "none of my users will pay that". I'm fairly certain that would be representative of the majority of our customers.
I won't disclose numbers, but hundreds of our customers got the license free from us because we've embedded that cost in the annual license that premium customers pay. We could have even subsidised the license entirely given the traffic increase directly derived from the adoption of the mod.
These are costs that our customers or their users should never have to pay and with the current implementation, they don't.
40% of my customers won't because they can't - they're iOS/macOS users.
With a single implementation in XenForo we're able to support the vast majority of mobile and desktop browsers combined - somewhere in the 75% region.
I don't know where you're getting those numbers from, but our macOS/iOS customers represent around 40% of our base.
Once Apple bridge this gap themselves - and there is no reason at all why they couldn't - that will be 100% from day one (depending on how much they deviate from the specification).
That may never happen and once again, I can't offer a service to just half my customers, that's asking for people to leave.

MHO.
 
Last edited:
That may never happen and once again, I can't offer a service to just half my customers, that's asking for people to leave.
Why not request an XF 2.1 version of the Pushover add-on if your users already use it?

I would love to see an official native app released but I think it's already been said that xenForo has no plans to work on it.

These push notifications are at least something, people like myself are happy about it (most of the other stuff included in 2.1 did not "wow" me) and maybe in the future, iOS/MacSafari might support it.
 
40% of my customers won't because they can't - they're iOS/macOS users.
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.
 
Not going to happen, just on principle. We do not want to support separate proprietary APIs for something that should be free and open, and available to all.

Just to be clear, our current implementation specifically uses modern and supported browser standards and APIs. We don't have to (generally) concern ourselves with whether it's Chrome, Firefox, or even some hardly known Firefox/Chromium fork - it just works™️. Once Apple gets on board with it, supporting Safari and iOS browsers likely won't even require any sort of update from us, it will just work.

Web standards are important. As webmasters we all hate Internet Explorer, right? In different contexts and scales, I'm sure, but at some point we've all had that one thing that we've not been able to do, or had to do differently because that one prevalent browser couldn't follow the same rule book as everyone else. We might have been able to stand for it 20 years ago when choices were few and far between, but why should we stand for it now? Why should Apple be that one that can't follow the same rules as everyone else? Why should webmasters have to go through the complexity and expense of setting up a developer account for something that is free and a couple of clicks to implement from everyone else? Why should your users have to pay money for something they can get for free from any other browser? Why should they even have to download yet another app on their phone to get it? Why should we have to develop and support some sort of multi-adapter system when we can support all but one browser vendor out of the box, for free, forever?

When we considered adding this feature, it was a direct choice between providing it now to the majority of users or depriving everyone while we wait for Apple to catch up. It was a difficult decision, but as someone who is very much an Apple fan and part of the Apple ecosystem, I stand by that decision and have no regrets.

Perhaps my regret will come when iOS 13 is announced with, yet again, no sign of Apple changing their stance on this, and we find ourselves facing yet another year without this most simplest of features that everyone else already has. But we'll see.
 
Back
Top Bottom