Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pushing to thousands of installations #9

Closed
fasa23 opened this issue Mar 31, 2016 · 3 comments
Closed

pushing to thousands of installations #9

fasa23 opened this issue Mar 31, 2016 · 3 comments

Comments

@fasa23
Copy link

fasa23 commented Mar 31, 2016

Im currently sending push notifications to my app from my parse-server on DigitalOcean.

I have almost 20K installations and when I send a push to all of them, it takes almost 20 min to be received on the iphone.
In my case this is awfull because I notify soccer matches and users want to know as soon as their team scores a goal.
Ive seen on the parse-server documentation that push notifications "Does not support super high throughput since it does not employ a job queue system" and im assuming the server is sending push notifications one by one and thats why my console logs every second:

"Notification transmitted to:" + device.token.
But it takes to much time to receive the notification on the iPhone, I think my token is one of the last on that loop.

I would like to know if i can modify any file to avoid the loop and send the push notification faster, Ive found a file under parse-server/node_modules/apn/examples/sending-to-multiple-devices.js where I found this function

// If you plan on sending identical paylods to many devices you can do something like this.
function pushNotificationToMany() {
    console.log("Sending the same notification each of the devices with one call to pushNotification.");
    var note = new apn.notification();
    note.setAlertText("Hello, from node-apn!");
    note.badge = 1;

    service.pushNotification(note, tokens);
}

So. Is there a way i can call to this function from cloud code? because when I use Parse.Push.send() from cloud code I assume my server is using this other function (service.on) inside sending-to-multiple-devices.js and thats why i get that log on my console each second

service.on("transmitted", function(notification, device) {
    console.log("Notification transmitted to:" + device.token.toString("hex"));
});

Im currently using no adapters to push my notifications, Ive seen OneSignal is a great option but the problem is that users who dont update the app will still be hitting parse installations records (so their subscriptions to soccer teams might be modified and I wouldnt be capable of noticing it) I would be really happy if theres an alternative in wich I dont have to implement any Push Adapter

Sorry for my english

@flovilmart
Copy link
Contributor

I'd gladly accept a PR for using the token list, that should not be that difficult to implement.

@fasa23
Copy link
Author

fasa23 commented Mar 31, 2016

Please could you implement it? And also please give an example on how to use that token list directly from cloud code. I'm pushing to users who are subscribed to a Channel using parse.query to get the users installations who have to receive the goal-scored notification.

@flovilmart
Copy link
Contributor

Please test from #10

If you wanna use if from cloud code, I can't really help, I'm not a hotline for special implementation needs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants