SimplePush
What it is, how to use it
The Problem
Solution:
How it works: From the user’s POV
An installed app displays a page with a subscribe button.
How it works: From the user’s POV
User sees confirmation page (optional) and goes about their day.
How it works: From the user’s POV
Later, the user gets an action relevant to their selected interest and great joy is had.
How it works: From the user’s POV
When the user no longer �wants updates, it is easy
to disable them.
How it works: Behind the curtain
An App defines in it’s Manifest, that it wants to use Push notifications.
{� "permissions": {� "push": {"description": "To receive Cat Fact notifications"}� },� "messages": [� {"push": "/view_to_launch.html"},� {"push-register": "/view_to_launch.html"}� ]�}
How it works: Behind the curtain
Once the user selects the app, it displays the web page defined in the “push-register” of the manifest.
How it works: Behind the curtain
On that page, the javascript calls�navigator.push.register()
and gets back an object containing the endpoint:
e.g.
https://push.services.mozilla.com/update/01aLongStringOfCrap123...
How it works: Behind the curtain
The app sends the endpoint to it’s own server.
When something interesting happens and the application is not already connected to the server, it PUTs a version number to the endpoint.
curl -X PUT “https://push.services.mozilla.com/update/01aLSOC...” �--data “version=1”
How it works: Behind the curtain
The client gets the notification from push.services.mozilla.com, activates the app and sends a ‘push’ event message with the new version.
How it works: Behind the curtain
The app can then connect back to the app server and process commands normally.
Best Practices
Simplepush is a doorbell not a walkie talkie.
✓
✓
X
Best Practices
SimplePush is data free. Don’t rely on version numbers, just know that they will increase.
As to Q:
Why not send data through SimplePush?
We don’t want to be subpoenaed.
As to Q:
Can we send a notification to everyone that uses our app?
Sure. Just send one per registered endpoint.
As to Q:
No, I mean can I send a single push that updates every client of mine?
No. You can’t. There are a few reasons for that (including user privacy, again). We’re working on a “bulk update” where you can update a bunch of endpoints in one go, but it’s not ready yet.
As to Q:
What’s the cost?
Hopefully free, but we may ask heavy users to donate.
As to Q:
What’s the benefit of using this?
Any other Questions?
More information:
Specification:
https://wiki.mozilla.org/WebAPI/SimplePush
Mail List:
https://mail.mozilla.org/admindb/dev-simplepush
IRC:
mozilla#push
Hack Tutorial: