Giter Club home page Giter Club logo

pnotifier's Introduction

Pnotifier Build Status

Push Notification Services Abstraction

Example with APN

It works the same for GCM or WNS. You just have to change the structure of the parameters object. And that's it !

var Pnotifier = require('pnotifier').Service;

var service = new Pnotifier({
	protocol: 'apn',
	credentials: {
		cert: 'cert_path.pem',
		key: 'key_path.pem'
	},
	options: {
		...
	}
});

service.createConnection(function (err) {

	service.send(['list_of_devices_token','...'],
		{
			alert: 'Hello World!',
			payload: {
				messageFrom: 'Thomas from Evertygo'
			}
		},
		function (err) {
			service.close();
		}
	);
});

APN config structure

All the options are the same as the node-apn package. But with a particular structure as described below.

var apnConfig = {
	credentials: {
		cert: 'cert_path.pem',
		key: 'key_path.pem',
	},
	options: {
		// node-apn options (except cert, key and token)
	}
};

GCM config structure

All the options are the same as the node-gcm package. But with a particular structure as described below.

var gcmConfig = {
	credentials: {
		api_key: '...',
	},
	options: {
		// node-gcm options (except api_key and tokens)
	}
};

WNS config structure

All the options are the same as the wns package. But with a particular structure as described below.

var wnsConfig = {
	credentials: {
		client_id: '...',
		client_secret: '...',
		channelURI: '...'
	},
	options: {
		// node-apn options (except client_id, client_secret and channelURI)
	}
};

License

Pnotifier is open-source licensed under the MIT license

pnotifier's People

Contributors

tbzr avatar tibolami avatar

Watchers

James Cloos avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.