unifiedpush-registration-client
v0.2.0
Published
Registration REST client for the AeroGear UnifiedPush Server
Downloads
7
Maintainers
Readme
Unified Push Registration Client
A client for registering Devices to the AeroGear UnifiedPush - https://aerogear.org/docs/specs/aerogear-unifiedpush-rest/#home
API Documentation
http://bucharest-gold.github.io/unifiedpush-registration-client/
Example
'use strict';
const registrationClient = require('unifiedpush-registration-client');
const baseUrl = 'http://127.0.0.1:8080/ag-push';
const settings = {
variantId: 'SOME_VARIANT_ID',
secret: 'VARIANT_SECRET'
};
const deviceOptions = {
deviceToken: 'SOME_VALID_DEVICE_TOKEN',
alias: 'thing'
}
registrationClient(baseUrl)
.then((client) => {
return client.registry.registerDevice(deviceOptions)
.then((deviceRegistration) => {
console.log('deviceRegistration', deviceRegistration);
});
})
.catch((err) => {
console.log('Error', err);
});
Importer
There is also a importer
function that allows mass device registration.
Along with the settings object, you also need to pass it a list of devices.
This list of devices must be an array and can be passed in as a .json file or a JSON object