Welcome the new Web API for Push Notifications

Before diving into it let's review 2 concepts in Firefox OS

+--------+ +--------+ +--------+ +--------+ | webapp | | user | | push | | app | | | | agent | | server | | server | +--------+ +--------+ +--------+ +--------+ | | | | |-----register------>| | | | | | | | (user accepts) | | | | | | | |<-setup push service->| | | | | | |<---success---------| | | | | | | |<--activate service with PushService attributes----------------->| | | | | | | |<--push notification-| | | | per service API | | | | | | | (match to user agent) | | | | | | |<--push notification--| | | | per service protocol | | | | | | | (match to webapp) | | | | | | |<---system message--| | | | | | |

but before, what kind of information do we send through the Simple Push API ?









Now YES, let's take a look ;)

And decide which document will handle the notification

We need to ask for 'push' permissions

3. Share the end point with your server side app





Once we send the end point to our server, this can start sending notifications just by doing:









curl -X PUT --data 'version=<version_number>' '<end point we got>'

The version number must be autoincremental.

So we need to keep track of it.