iOS push notifications: How to handle thousands of them at the same time?

We want to use push notifications to inform our users about new app features or great content. These will only be sent occasionally, but should go to all users of our app.

We’ve already implemented push notifications in general and calculate the badge numbers for them on server side. This works fine when sending push notifications as transactional information (e.g. “user X has followed you”), but if we send them to thousands (or even millions) of users at the same time, obtaining and sending the badge count as a payload seems to be a bit crazy. But as far as I can tell from the docs, there is no way to tell iOS “increase it by one”. At least unless you use “silent push notifications”, but our notifications should be visible to the users.

Besides that, I am a bit worried about sending thousands (or even millions) of calls to APN at the same time. What is the best practice here? Do people send these notifications all in one giant burst, or are they sending smaller chunks (like 1.000 at a time) and then pause for a couple of seconds before they send the next load? I can’t find any recommendation on Apple’s pages on how to handle this and what they expect on their end.

I recommend you use an AWS lambda function and AWS SNS to do this. You can subscribe the users to a topic and send one message to that topic that will notify all the users.

1 Like

This still doesn’t solve the badge update problem, because iOS requires the badge to be set with every single message.

You can try this package The trusted source for JavaScript packages, Meteor resources and tools | Atmosphere

Config is like

  apn: {
    certData: Assets.getText('apnDevCert.pem'),
    keyData: Assets.getText('apnDevKey.pem'),
    passphrase: 'xxxxxxxxx',
    production: true,
    //gateway: '',
  gcm: {
    apiKey: 'xxxxxxx',  // GCM/FCM server key
  // production: true,
  // 'sound' true,
  // 'badge' true,
  // 'alert' true,
  // 'vibrate' true,
  // 'sendInterval': 15000, Configurable interval between sending
  // 'sendBatchSize': 1, Configurable number of notifications to send per batch
  // 'keepNotifications': false,

It supports batch sending so you can send more then one at once.

Thanks, but I aready have push notifications enabled (and I am not using Cordova). I am using node-pushnotifications directly. It also supports batch sending. However, this won’t work if you want to set the badges accordingly, because this is a property of each and every notification. So I was wondering how other people deal with the challenge to address thousands of recipients and updating their badge numbers at the same time.

I think in that case you would need a key pair store like userid: badge and just increment for each iteration so you know the badge number (e.g badge++)

When I’ve used it before though this was handled on the OS but I was using Cordova so maybe different in your case. Hope that helps

1 Like