Confirmed users
93
edits
No edit summary |
No edit summary |
||
Line 21: | Line 21: | ||
;version | ;version | ||
SimplePush does not carry information, only versions. A version is a number that keeps increasing. The AppServer tells the Endpoint about a new version whenever it wants an App to be notified. | SimplePush does not carry information, only versions. A version is a number that keeps increasing. The AppServer tells the Endpoint about a new version whenever it wants an App to be notified. | ||
== Use Cases == | == Use Cases == | ||
Line 53: | Line 41: | ||
== For App developers == | == For App developers == | ||
=== Client (WebApp) code === | |||
Apps will need to add the following to their [https://developer.mozilla.org/en-US/docs/Apps/Manifest manifest]. See our Web App Development Guide for what this means and how to use it. | Apps will need to add the following to their [https://developer.mozilla.org/en-US/docs/Apps/Manifest manifest]. See our Web App Development Guide for what this means and how to use it. | ||
Line 129: | Line 119: | ||
} | } | ||
}); | }); | ||
=== On the AppServer === | |||
When the application server makes some change to its state, which it feels is important to a certain user, it should use the associated Endpoint to notify the PushServer. For example, when an email server receives a new email whose recipients have MyAmazingEmailApp installed on their devices, every user will have an associated Endpoint. So the server should send a PUT request to every one of those endpoints, with 'version=<version>' in the body of the HTTP request (that is, as form data). Here is a curl example: | |||
curl -X PUT --data 'version=5' 'http://mypushserver.com/notificaton/forUserBob' | |||
where 'http://mypushserver.com/notification/forUserBob' is the Endpoint sent by the App. | |||
'''IMPORTANT NOTE:''' It is very likely that users will install their apps on multiple devices. In this case, each installation of the app has a different Endpoint. You should design your server side storage so that each piece of information may have multiple Endpoints to be notified when it changes. | |||
== DOM Interface == | == DOM Interface == | ||
Line 174: | Line 174: | ||
* Web pages using push notification should show a doorhangar notification in the same way (look at geolocation to see how this is done). | * Web pages using push notification should show a doorhangar notification in the same way (look at geolocation to see how this is done). | ||
=== | === Protocol === | ||
[[/ | [[/Protocol|Protocol]] has the details of how the UserAgent and PushServer communicate. | ||
Chances are, all you want is to send a new version update. | Chances are, all you want is to send a new version update. |