Skip to content

Instantly share code, notes, and snippets.

@AndersonChoi
Last active Jun 25, 2016
Embed
What would you like to do?
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