I have used above mentioned packages in my meteor code to send push notifications to cordova mobile,but I am able to send a message to the token one by one.But I want to send a single message to several tokens at time and immediately mobile should receive the notification as soon as it fires but after some 5 minutes it is receiving.Please help me out.
Here I have attached my code below:
client side:
if (Meteor.isCordova) {
function onDeviceReady () {
// alert("Calling onDeviceReady()");
Push.Configure({
android: {
senderID: mySenderId,
alert: true,
badge: true,
sound: true,
vibrate: true,
clearNotifications: true
},
ios: {
alert: true,
badge: true,
sound: true
}
});
Push.addListener("token", function(token) {
console.log("push notification listened",token);
Session.set("myToken",token);
// alert(JSON.stringify(token));
});
}
server side to send message:
serverside startup:
Meteor.startup(function () {
Push.debug = true;
Push.allow({
send: function(userId,notification) {
console.log("allow");
return true; // Allow all users to send
}
});
Push.Configure({
gcm: {
apiKey: 'mykey,
projectNumber: mySenderId
},
production: false
});
})
I inserted the token which has been set at key “myToken” to LoginFamilyID collection.