Module: UnifiedPushClient

AeroGear. UnifiedPushClient

new UnifiedPushClient(variantID, variantSecret, pushServerURL) → {Object}

Status: Experimental
The UnifiedPushClient object is used to perfom register and unregister operations against the AeroGear UnifiedPush server.
Parameters:
Name Type Description
variantID String the id representing the mobile application variant
variantSecret String the secret for the mobile application variant
pushServerURL String the location of the UnifiedPush server e.g. http(s)//host:port/context
Source:
Returns:
The created unified push server client
Type
Object
Example
        // Create the UnifiedPush client object:
        var client = AeroGear.UnifiedPushClient(
            "myVariantID",
            "myVariantSecret",
            "http://SERVER:PORT/CONTEXT"
        );

        // assemble the metadata for the registration:
        var metadata = {
            deviceToken: "http://server.com/simplePushEndpoint",
            alias: "some_username",
            categories: [ "email" ]
        };

        var settings = {};

        settings.metadata = metadata;

        // perform the registration against the UnifiedPush server:
        client.registerWithPushServer( settings );

Methods

registerWithPushServer(settings) → {Object}

Performs a register request against the UnifiedPush Server using the given metadata which represents a client that wants to register with the server.
Parameters:
Name Type Description
settings Object The settings to pass in
Properties
Name Type Description
metadata Object the metadata for the client
Properties
Name Type Argument Description
deviceToken String identifies the client within its PushNetwork. On Android this is the registrationID, on iOS this is the deviceToken and on SimplePush this is the URL of the given SimplePush server/network.
alias String <optional>
Application specific alias to identify users with the system. Common use case would be an email address or a username.
categories Array <optional>
In SimplePush this is the name of the registration endpoint. On Hybrid platforms like Apache Cordova this is used for tagging the registered client.
operatingSystem String <optional>
Useful on Hybrid platforms like Apache Cordova to specifiy the underlying operating system.
osVersion String <optional>
Useful on Hybrid platforms like Apache Cordova to specify the version of the underlying operating system.
deviceType String <optional>
Useful on Hybrid platforms like Apache Cordova to specify the type of the used device, like iPad or Android-Phone.
Source:
Returns:
An ES6 Promise created by AeroGear.ajax
Type
Object

unregisterWithPushServer(deviceToken) → {Object}

Performs an unregister request against the UnifiedPush Server for the given deviceToken. The deviceToken identifies the client within its PushNetwork. On Android this is the registrationID, on iOS this is the deviceToken and on SimplePush this is the URL of the given SimplePush server/network.
Parameters:
Name Type Description
deviceToken String unique String which identifies the client that is being unregistered.
Source:
Returns:
An ES6 Promise created by AeroGear.ajax
Type
Object