Module: SimplePushClient

AeroGear. SimplePushClient

new SimplePushClient(options) → {Object}

Status: Experimental
The SimplePushClient object is used as a sort of polyfill/implementation of the SimplePush spec implemented in Firefox OS and the Firefox browser and provides a mechanism for subscribing to and acting on push notifications in a web application. See
Name Type Description
options Object an object used to initialize the connection to the SimplePush server
Name Type Argument Default Description
useNative Boolean <optional>
false if true, the connection will first try to use the Mozilla push network (still in development and not ready for production) before falling back to the SimplePush server specified
simplePushServerURL String <optional>
the URL of the SimplePush server. This option is optional but only if you don't want to support browsers that are missing websocket support and you trust the not yet production ready Mozilla push server.
onConnect Function a callback to fire when a connection is established with the SimplePush server. This is a deviation from the SimplePush spec as it is not necessary when you using the in browser functionality since the browser establishes the connection before the application is started.
onClose Function a callback to fire when a connection to the SimplePush server is closed or lost.
The created unified push server client
        // Create the SimplePushClient object:
        var client = AeroGear.SimplePushClient({
            simplePushServerURL: "https://localhost:7777/simplepush",
            onConnect: myConnectCallback,
            onClose: myCloseCallback