Skip to content

Instantly share code, notes, and snippets.

@Sivli-Embir
Last active August 29, 2015 14:13
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 Sivli-Embir/5359aa93bba5cb890a79 to your computer and use it in GitHub Desktop.
Save Sivli-Embir/5359aa93bba5cb890a79 to your computer and use it in GitHub Desktop.
var pushConfiguration = null;
testRunner = function (notification, user) {
if(!pushConfiguration)
{
Push.debug = this.debug || false;
pushConfiguration = Push.Configure({
gcm: {
apiKey: this.gcm,
},
production: true, // use production server or sandbox
});
}
console.log("Herald-PushNotifications: sending notification",notification,user);
return true;
};
checkRunner = function (notification, user) {
console.log(notification);
if (notification && (!notification.data || !notification.data.title))
throw new Error('Herald-PushNotifications : notification "title" field must be defined');
if(!(this.gcm || this.apn))
throw new Error('Herald-PushNotifications : atleast "apn" or "gcm" fields must be defined',this);
};
var courier = {
gcm: '***************',
debug:true
};
var notification = {
data: {
from: 'xxxx',
title: 'xxxxxxxx',
text: '',
payload:{type:"approved",msgcnt:1}
}
};
runTestRunner = function () {
for (var i = 10 - 1; i >= 0; i--) {
checkRunner.call(courier, notification, Meteor.user());
testRunner.call(courier, notification, Meteor.user());
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment