CloudServices/Notifications/Specification/BrowserJS

From MozillaWiki
Jump to: navigation, search

The following is the JavaScript API to be exposed by the browser to allow web apps to request permission to send notifications.

navigator.pushNotifications.requestPermission(
    {"app_name": "GMail",
     "account": "sdasilva@gmail.com"}, 
    function callback({token, encryptionKey, hmacKey, serverURL}) {
        ...
    }
);

Once the client has added the subscription to the notification service, it will call the callback function, passing back the token, encryption key, and POST Office serverURL to send notifications to.