1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

Add-on Push Notifications - OSX Safari

Discussion in 'Resource and Add-on Requests' started by Mouth, Oct 23, 2013.

  1. Mouth

    Mouth Well-Known Member

  2. RobParker

    RobParker Well-Known Member

    Was just about to come in here and suggest that. With Mavericks out, push notifications seem like they might be doable?
     
    Mouth likes this.
  3. Jeremy

    Jeremy XenForo Moderator Staff Member

    @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 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
     
    RobParker likes this.
  4. Mouth

    Mouth Well-Known Member

    20% of my visitors come from OS/X and my broad site topic has nothing to do with computers, let alone Apple.
     
  5. Jeremy

    Jeremy XenForo Moderator Staff Member

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

    Mouth Well-Known Member

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

    digitalpoint Well-Known Member

    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.
     
    Andrej, nrep, Mouth and 2 others like this.
  8. Jeremy

    Jeremy XenForo Moderator Staff Member

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

    Mouth Well-Known Member

    Wow! Awesome, congrats!
    Very comfortable, and fully understanding, of that disclaimer.
    Would love to test it further for you ;)
     
  10. digitalpoint

    digitalpoint Well-Known Member

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

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

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

    Of course clicking on the notice will take them to the relevant piece of content.
     
    DRE and Daniel Hood like this.
  11. digitalpoint

    digitalpoint Well-Known Member

    Hmmm... I think I'm kind of liking this thing more than I thought I would. lol Still will be infinitely better if Safari on iOS ever starts supporting it.

    upload_2013-10-28_2-34-54.png
     
  12. RobParker

    RobParker Well-Known Member

    Excellent work :)

    This is limited to Safari on Mavericks, right?
     
  13. digitalpoint

    digitalpoint Well-Known Member

    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).
     
    RobParker likes this.
  14. Chris D

    Chris D XenForo Developer Staff Member

    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.
     
    Alfa1 and RobParker like this.
  15. RobParker

    RobParker Well-Known Member

    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.
     
  16. Chris D

    Chris D XenForo Developer Staff Member

    Oops. I missed that post! That does seem pretty extreme.
     
  17. Daniel Hood

    Daniel Hood Well-Known Member

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

    Jeremy XenForo Moderator Staff Member

    That's definitely something I'd pay for, Shawn. :) Great work!
     
  19. Mouth

    Mouth Well-Known Member

    Would love to see this as a released add-on, please :) Disclaimers included.
     
  20. digitalpoint

    digitalpoint Well-Known Member

    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.
     
    DRE likes this.

Share This Page