Last active
August 29, 2015 14:13
-
-
Save Sivli-Embir/5359aa93bba5cb890a79 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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