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

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:

Ludachris

Well-known member
@Chris D - forgive me if you've already answered this, but have you guys considered creating something of a hybrid app? Not a full blown mobile version of the forum like Tapatalk that most people envision. All interaction with the forum would still take place in a browser. The app would act as nothing more than an alerts system for the forum, along with common navigational entry points into the site (post a thread link, main menu links, PM link, profile link, new posts, etc - configurable by admin) which would simply open in a browser.

For example, the user gets an alert on their phone that someone has replied to their thread or sent them a PM, when they click the alert link to read/respond, it opens the site in a browser. No replication of the user experience beyond navigation and alerts.

I could see this being a perfect solution to take advantage of the fact that mobile alerts are becoming the standard for prompting interaction/participation, while still retaining the purity of the user experience through the base forum code rendering in a browser. This would also make it so that all add-ons which tie into XF's alerts system (like Showcase for example) would be represented in those mobile alerts automatically. No worries of add-ons not being compatible with the mobile app.

The forum owner will obviously assume the responsibility of submitting the app to the app stores and paying any associated fees.

I'm sure someone who understands the world of mobile apps has already thought of this approach and hasn't pursued it for a reason. It seems like a great idea to me but I imagine there are some major roadblocks, or something that probably makes this very difficult.
 

Ludachris

Well-known member
That's.... what.... happens now already, with push alerts.
Not for iOS users. These push alerts use the browser's notification system, not the phone's native notification system (correct me if I'm wrong). And while that's better than nothing, as Chris and others have already stated, it's highly unlikely that the same solution will be made to work with iOS devices anytime soon, if ever. And that's a problem for anyone who has a community made up of a large user base of iOS users like ours.
 

Chris D

XenForo developer
Staff member
@Chris D - forgive me if you've already answered this, but have you guys considered creating something of a hybrid app? Not a full blown mobile version of the forum like Tapatalk that most people envision. All interaction with the forum would still take place in a browser. The app would act as nothing more than an alerts system for the forum, along with common navigational entry points into the site (post a thread link, main menu links, PM link, profile link, new posts, etc - configurable by admin) which would simply open in a browser.

For example, the user gets an alert on their phone that someone has replied to their thread or sent them a PM, when they click the alert link to read/respond, it opens the site in a browser. No replication of the user experience beyond navigation and alerts.

I could see this being a perfect solution to take advantage of the fact that mobile alerts are becoming the standard for prompting interaction/participation, while still retaining the purity of the user experience through the base forum code rendering in a browser. This would also make it so that all add-ons which tie into XF's alerts system (like Showcase for example) would be represented in those mobile alerts automatically. No worries of add-ons not being compatible with the mobile app.

The forum owner will obviously assume the responsibility of submitting the app to the app stores and paying any associated fees.

I'm sure someone who understands the world of mobile apps has already thought of this approach and hasn't pursued it for a reason. It seems like a great idea to me but I imagine there are some major roadblocks, or something that probably makes this very difficult.
I'm not going to be all secretive and refuse to answer. I'd be dishonest if I said it hadn't crossed our minds. It's not even something that's totally off the table, but essentially what you're suggesting is actually a fairly huge impact in terms of development time and on-going support. There are different ways of delivering an app, of course. Discourse has a kind of companion app type of affair where it is a Discourse branded app, but you can add any Discourse forum to it, benefit from push notifications etc. all within a webview wrapper. That kind of approach is appealing versus a native app or some sort of forum-exclusive white label app, but even that is not an insignificant undertaking.

I can tell you now, though, the likelihood is that it would only ever be used by iOS users who cannot otherwise receive push notifications. That is literally the only benefit of us producing something like that. Because everyone else who is not on iOS (or macOS Safari) can already get the benefits that such an app provides, entirely in their existing browsers.

While we're not closed from potentially going down that route in the future, we should really be directing our feedback towards Apple and putting some pressure on them so they are fully aware that this kind of feature is important to their user base.

Occasionally Tweeting some of the WebKit developers, or even sending emails to Apple employees every once in a while might help.

 

Chris D

XenForo developer
Staff member
To clarify:
These push alerts use the browser's notification system, not the phone's native notification system
The push notifications functionality discussed in this thread absolutely uses the phone/device's native notification system if you are using Windows, Android, or any browser other than Safari on macOS.

So creating an app would only provide the missing functionality to iOS users and be of no additional benefit to any other platform. In fact, if we did anything like this, it might even be iOS only.

That's really why the answer is that Apple/WebKit should be making this work - not us.
 

Ludachris

Well-known member
Understood, and thanks for the detailed response Chris. With that in mind then, maybe it's worth organizing some sort of petition that we (as forum owners) can all sign and encourage our members to sign to show Apple how important this is. Not that I think they would be swayed much by it, as they do what they want when they want and how they want to do it - and I get the feeling that they probably look down on forums as obsolete technology anyway. But it's still important to show them proof that people want this. It's worth a shot.
 

Chris D

XenForo developer
Staff member
Push notifications would benefit almost every single website on the internet. Whether it a traditional internet forum, or a WordPress blog, or an international news corporation website - every user of every one of these types of websites could benefit from push notifications.

As I mentioned in my tweets above, Apple are even supporting a big push towards Progressive Web Apps - one of the big things there is engagement. So, if they really want to support that as a concept, they really need to implement push notifications in order to allow these web apps to keep their users engaged.

Not against some sort of campaign, but I would at least wait to see what is announced in WWDC in June for iOS 13 and macOS 10.15.
 

leebo

Active member
Push notifications would benefit almost every single website on the internet. Whether it a traditional internet forum, or a WordPress blog, or an international news corporation website - every user of every one of these types of websites could benefit from push notifications.

I personally would disagree. Push Notifications for every website would IMHO turn Push Notifications into the new Spam. I'm already seeing more and more "please click here" messages to subscribe to Push Notifications as the technology becomes the new norm. If Apple allows websites to use push notifications on iOS devices I personally will disable them ASAP.

That said, there’s still a goldmine working with Apple to make things work on their devices.
 

RobinHood

Well-known member
So creating an app would only provide the missing functionality to iOS users and be of no additional benefit to any other platform.

One iOS app please!

Essentially Pushover, but for XenForo. You can add any forum you like and the alerts redirect you from the app to safari so you get the full mobile experience. Then you don't need to worry about recoding the whole web UI the app.

Free app, but we pay packs of or unlimited push notifications, which can then be offered to members on the admins site for free or as an upgrade. Paying for what you use so that it's accessible to both small and big boards.

You already made one pushover plugin, so you've got a head start, how hard can it be to reproduce the full app 🤓

:p

Maybe this will finally be the year! hah

I hear that same phrase a lot from old Mac Pro users, and they're still waiting :(
 

Ludachris

Well-known member
One iOS app please!

Essentially Pushover, but for XenForo. You can add any forum you like and the alerts redirect you from the app to safari so you get the full mobile experience. Then you don't need to worry about recoding the whole web UI the app.

Free app, but we pay packs of or unlimited push notifications, which can then be offered to members on the admins site for free or as an upgrade. Paying for what you use so that it's accessible to both small and big boards.

You already made one pushover plugin, so you've got a head start, how hard can it be to reproduce the full app 🤓

:p
That's essentially what I was envisioning. Maybe we can get an add-on developer to build this as a paid option until Apple decides to open the doors. I know I'd pay a decent price for the add-on.
 

DaveL

Well-known member
I've tried reading through, but not see what I was looking for.
Is there an SSH command to see if GMP is already installed? I've only just set up my vps with php 7.3 installed.

To install GMP i've found its "yum install gmp-devel" - However I can't seem to find what the command is to recompile php afterwards. Any help appreciated.

EDIT - i've just typed php -m and it shows GMP - So i'm guessing im good to go?
 
Last edited:

Wildcat Media

Well-known member
The app would act as nothing more than an alerts system for the forum, along with common navigational entry points into the site (post a thread link, main menu links, PM link, profile link, new posts, etc - configurable by admin) which would simply open in a browser.
I had that same idea five years ago. But it's not a big deal since I'm getting push notifications on all of my devices. (Obviously I don't, and won't, own anything from the fruitly-named company.) Still, there are users out there who are missing out, which isn't right, and that aforementioned company needs to get their heads out of their self-important arses and start thinking of their end users for a change. Hopefully if enough people make enough noise, they'll come to their senses.
 

Chris D

XenForo developer
Staff member
I've tried reading through, but not see what I was looking for.
Is there an SSH command to see if GMP is already installed? I've only just set up my vps with php 7.3 installed.

To install GMP i've found its "yum install gmp-devel" - However I can't seem to find what the command is to recompile php afterwards. Any help appreciated.

EDIT - i've just typed php -m and it shows GMP - So i'm guessing im good to go?
The Server Environment Report on your Admin CP home page will tell you whether you have GMP:

203281
 

Ludachris

Well-known member
I had that same idea five years ago. But it's not a big deal since I'm getting push notifications on all of my devices. (Obviously I don't, and won't, own anything from the fruitly-named company.) Still, there are users out there who are missing out, which isn't right, and that aforementioned company needs to get their heads out of their self-important arses and start thinking of their end users for a change. Hopefully if enough people make enough noise, they'll come to their senses.
As a user who receives push notifications I understand that response, as it's not hindering you. As a forum owner, I don't, as a large percentage of your forum users are affected.

The fruitly-named company isn't concerned with how "our" users connect to "our" apps, and there is no real reason for them to be. I don't see it as their problem, I see it as mine. I'd be doing my forums a disservice by not trying to find a work around in the event that Apple never actually addresses this. It's not just Apple users who are missing out, it's all of our forum members, since it hinders participation. It limits growth. It limits our ability to maximize our community.

Some here might be content with sitting around and hoping Apple finally address this, but I feel we need to be looking for proactive solutions so that half our target audience (or more in our case) can make use of a feature that has become an industry standard in today's digital world. Apple users aren't going to complain to Apple because they can't get push notifications from our forum, they'll simply just quietly use other websites (like FB) that do have push notifications more often - maybe not consciously, but over time, they'll end up posting more in those other places because they've been prompted to, even if they love the forum and have been great contributors over the years. That's just the reality of it.

Again, if anyone else feels like this is something they need to address and are willing to invest in a solution, send me a note. I'd be willing to do so as well.
 
Top