https://www.npmjs.org/package/unifiedpush-node-sender
NOTE: THE NAME OF THIS PACKAGE HAS CHANGED, THE NEW PACKAGE IS LOCATED ATaerogear-sender-client
Node Sender API for the AeroGear Unified Push server
Getting Started
Pre Reqs:
- node.js
- npm
- git
Building
clone and install:
$ git@github.com:aerogear/aerogear-unifiedpush-nodejs-client.git
$ cd aerogear-unifiedpush-nodejs-client
$ npm install
Running Tests
$ npm test
Add to a Project
In your project do
npm install path/to/aerogear-unified-push-node-client
or
install from npm
npm install aerogear-sender-client
Examples
Require the aerogear-sender-client
library
var agSender = require( "aerogear-sender-client" ).AeroGear,
url = "http://localhost:8080/ag-push";
Send a Message
You can use either listen for the success and error events
agSender.Sender( url ).send( message, settings ).on( "success", function( response ) {
console.log( "success called", response );
});
Or you can use a callback
agSender.Sender( url ).send( message, settings, function( err, response ) {
if( !err ) {
console.log( "success called", response );
return;
}
});