A client for registering Devices to the AeroGear UnifiedPush - https://aerogear.org/docs/specs/aerogear-unifiedpush-rest/#home
Project Info | |
---|---|
License: | Apache-2.0 |
Build: | make |
Documentation: | http://bucharest-gold.github.io/unifiedpush-registration-client/ |
Issue tracker: | https://github.com/bucharest-gold/unifiedpush-registration-client/issues |
Engines: | Node.js 4.x, 5.x, 6.x |
npm install unifiedpush-registration-client -S
'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);
});
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
Please read the contributing guide