Add-on Push Notifications - OSX Safari

Was just about to come in here and suggest that. With Mavericks out, push notifications seem like they might be doable?
 
@RobParker, they are. Still a limited market and have several fun requirements:
  • A singular URL may be used, but with some tricks it could cover most, if not all, of XenForo's URLs (URL with string: http://xenforo.com/community/%@/%@ where you provide the route and ID as arguments)
  • Notifications need to be sent via binary
  • Required checksum file; which will be different per-installation
  • Requires SSL:
    The URL to your web service; this is the same as the url parameter in window.safari.pushNotification.requestPermission(). Must start with https.
  • The API end-points used by Apple do not fit nicely with XenForo's system
  • TSL or SSL are required to actually send the request to Apple's APN servers
  • You are limited to 256 bytes within a notification
 
20% of visitors is still a relatively small market for an add-on / feature that has quite a bit of structural requirements. I would love to see a proof of concept add-on for this, but it does have a lot of technical requirements.
 
20% of visitors is still a relatively small market for an add-on / feature that has quite a bit of structural requirements. I would love to see a proof of concept add-on for this, but it does have a lot of technical requirements.
Yeah, obviously a developer would do it for the challenge and learning aspect rather than any financial return. I do believe % will jump considerable though when Apple allows the push notifications to work with iOS too in the next release (my speculation)
 
@RobParker, they are. Still a limited market and have several fun requirements
Yep, it's definitely not an easy thing. :)

But I started messing with it last night, and so far I have this stuff working:
  • URL handling for the notices (even for sub-domains in my case).
  • Dynamic generation of the push package (slight variations per user), including the proper sha1 checksums and signature unique to each user (generating the signature is obnoxious with all the public/private key crap).
  • Endpoints for push package downloading, error logging, adding/updating device permissions and requests for device deletion (done totally though XenForo routes... didn't need to do any weird hacking for those which surprised me)
  • System generates push notification JSON payloads for everyone who should receive a notification (this was way more complicated than you would think... not the actual JSON object, but so much stuff you need to do based on permissions of the user receiving the notice, rather than the visitor). I also decoupled this from the UI, so push notices are sent right away, but doesn't slow the user down that caused the notices to be fired.
My whole site is SSL already, so that part was no biggie. I think at this point all I really need to do is throw in the JavaScript that asks users if they want push notifications or not and also build the mechanism that does the actual sending of the notification payload to Apple's servers.

Before anyone asks, at this point I have no clue if this is going to be something that will be realistic to release for others. It has a lot of requirements that probably would make it a support nightmare for me.
  • You need an Apple Developer account ($99/year), and a Mac to make things much easier
  • You need to generate public/private keys and know how to extract them from .p12/.cert files
  • You would need to manually create the manifest file with valid SHA1 hashes for your files in it
  • My system will only run on Linux servers because of how the push package is generated dynamically
  • You would need SSL running on your site
Lol... so if I ever did toss it out there, it's going to come with a massive disclaimer... "I'm not helping you set up SSL on your web server, I'm not helping you set up an Apple Developer account, I'm not generating your certificates or public/private keys (which needs to be done annually since they are only valid for 1 year), I'm not setting up your manifest file or generating SHA1 hashes for all your sites in your push package." :)

Overall, it definitely will be infinitely more useful if they enable it in iOS.
 
Very nice, if you need help testing, let me know. (y) I was going to do a proof of concept for a project at school, glad to see you accomplishing it.
 
But I started messing with it last night, and so far I have this stuff working:
Wow! Awesome, congrats!
Lol... so if I ever did toss it out there, it's going to come with a massive disclaimer... "I'm not helping you set up SSL on your web server, I'm not helping you set up an Apple Developer account, I'm not generating your certificates or public/private keys (which needs to be done annually since they are only valid for 1 year), I'm not setting up your manifest file or generating SHA1 hashes for all your sites in your push package."
Very comfortable, and fully understanding, of that disclaimer.
Would love to test it further for you ;)
 
Well... decided to come back to this after a day of drinking and watching football... and I do believe it's working. :)

upload_2013-10-28_2-4-26.webp

upload_2013-10-28_2-6-31.webp

upload_2013-10-28_2-9-41.webp

Of course clicking on the notice will take them to the relevant piece of content.
 
Excellent work :)

This is limited to Safari on Mavericks, right?
Yep... only supported in OS X 10.9 and only in Safari. Although I don't use Safari myself (I use Chrome)... it's still handy seeing them come in since they still happen without Safari open.

But the *real* value will be when/if they ever open up the technology to Safari on iOS (iPhones, iPads and iPods).
 
Excellent work :)

This is limited to Safari on Mavericks, right?
It is.

But I believe @Daniel Hood has something working with regards to Notifications in Chrome which should cover a lot of ground also.

The Live Update add-on I'm looking after for @Naatan covers the rest of the browsers which, depending on compatibility, amends the browser favicon with the alert/inbox count or changes the page title to detail the number.

With that in mind... should we look to get this working as a single add-on? That way there'll be one add-on that effectively provides notifications to pretty much all browsers.
 
With that in mind... should we look to get this working as a single add-on? That way there'll be one add-on that effectively provides notifications to pretty much all browsers.

That'd be excellent. The number of requirements for OS X might be a bit of a barrier and like Shawn said, I imagine 99% of the support requests would be how to set up the server to meet those.
 
It is.

But I believe @Daniel Hood has something working with regards to Notifications in Chrome which should cover a lot of ground also.

The Live Update add-on I'm looking after for @Naatan covers the rest of the browsers which, depending on compatibility, amends the browser favicon with the alert/inbox count or changes the page title to detail the number.

With that in mind... should we look to get this working as a single add-on? That way there'll be one add-on that effectively provides notifications to pretty much all browsers.

My goal with the extension was to make it so forum owners didn't have to install anything, it would just work by defualt. It's not using a push method at this point though, just pulling. I was going to start porting to Firefox next but the way I'm doing it results in user's constantly appearing online. I've been looking through code to see if there's a way to stop the session from updating (with the limited access I have, input data) but haven't come across anything yet.

I may have to keep it how it is and provide an add on for the owners of sites that are bothered by this that stops it from happening.
 
I added push notifications for conversations now (so now it's everything that shows up in the Inbox popup as well as Alert popup). Testing it live on my site now (before it was only available to me), so if anyone wants to try it out, just log in to digitalpoint.com with a user account using Safari on OS 10.9.
 
  • Like
Reactions: DRE
Back
Top Bottom