Skip to content

Instantly share code, notes, and snippets.

@AndersonChoi
Last active June 25, 2016 06:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save AndersonChoi/a436f1d244016d4e6512edffa6e95961 to your computer and use it in GitHub Desktop.
Save AndersonChoi/a436f1d244016d4e6512edffa6e95961 to your computer and use it in GitHub Desktop.
var gcm = require('node-gcm');
var message = new gcm.Message();
var message = new gcm.Message({
collapseKey: 'demo',
delayWhileIdle: true,
timeToLive: 3,
data: {
key1: 'demo title.',
key2: 'push demo'
}
});
var server_access_key = 'push provider access key value';
var sender = new gcm.Sender(server_access_key);
var registrationIds = [];
var registration_id = 'android registration_id value';
registrationIds.push(registration_id);
/**
* Params: message-literal, registrationIds-array, No. of retries, callback-function
**/
sender.send(message, registrationIds, 4, function (err, result) {
console.log(result);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment