Skip to content

Latest commit

 

History

History
202 lines (134 loc) · 4.42 KB

README.md

File metadata and controls

202 lines (134 loc) · 4.42 KB

Cordova Push Server

Cordova Push Server is a cross-plateform push server based on node-apn and node-gcm. Cordova Push Server currently supports iOS (APN) and android (GCM) platforms.

Cordova Push Server can be called in shell:

$ cordovapush

Or in a JavaScript application:

var cordovapush = require('cordovapush');

Documentation

The documentation is here.

Quick start

Pre-requisite

Start MongoDB:

$ sudo mongod

Install & Start

$ npm install -g cordovapush
$ cordovapush new [server_name]
$ cd [server_name]
$ cordovapush start

Configuration

Android

GCM service configuration:

{
	sender : 'api_key'                                 /* Your API Key */
}

See GCM documentation.

iOS

APN service configuration:

{
	cert: 'absolute/path/to/the/cordovapush.pem',      /* Certificate file path */
	key:  'absolute/path/to/the/cordovapushkey.pem',   /* Key file path */
	passphrase: '****',                                /* Passphrase for the Key file */
	gateway: 'gateway.sandbox.push.apple.com',         /* Gateway address */
	port: 2195,                                        /* Gateway port */
	enhanced: true,                                    /* Enable enhanced format */
	cacheLength: 100                                   /* Number of notifications to cache */
}

See node-apn documentation.

Web

Web server configuration:

{
	port : 8080,                                       /* Listening port */
	debug : true                                       /* Active logging request mode */
}

Mongo

MongoDB configuration:

{
	url : 'mongodb://localhost/cordova'                /* MongoDB URL */
}

Usage

Sending interface

http://domain:port/send (GET & POST)

Subscribe

http://domain:port/subscribe (POST)

or

http://domain:port/save (POST)

data:

{
	type : device_type (android || ios),
	token : device_token
}

Unsubscribe

http://domain:port/unsubscribe (POST)

or

http://domain:port/clean (POST)

data:

{
	type : device_type (android || ios),
	token : device_token
}

Alias

http://domain:port/alias (POST)

data:

{
	type : device_type (android || ios),
	token : device_token,
	alias : alias_name
}

Commands

new

Create a new server directory.

start

Start server from current directory.

Dependencies

Tags

Cordovapush tags.

History/Changelog

Take a look at the history.

License

MIT :

Copyright (C) 2012 Smile Mobile Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.