Search code examples
iosnotificationsapn

Working with APNS in production apps


Using APNS in small environments and low volume notifications is not the problem.

The problem (for me at least) is how to work with APNS limitations in a large, high volume of notifications environment.

APNS has some limitations (by design) that make it harder for smooth work

  1. Constant connecting and disconnecting from the APNS might considered a DOS attack. This leads me to believe I need to batch-send the notifications every few seconds and not have a "real time" sending

  2. There is no knowledge if a notification has arrived or sent succesfully. Only when there is an error, it is returned, and when returned it might not be immediate.

  3. When a notification causes an error (for example due to a bad token) the connection is closed by the APNS, and the rest of the notifications in that batch won't be sent to their destination, but some might still be sent to APNS and then lost forever (no feedback on success, so there is no knowledge what happened to them).

How are real-life production apps work with APNS to work around the mentioned problems? Should I save all notifications that I send and for each to check if an error was returned? Should I put them in a queue? Should I just face the fact that there will be notifications that won't be sent? What is a reasonable time between connections so it won't count as a DOS attack?

(at the moment I use Houston in Ruby for handling notifications)


Solution

  • As you know APNS Service is not reliable. You can use Amazon Simple Notification Service (Amazon SNS).

    It is is a fast, flexible, fully managed push notification service that lets you send individual messages or to fan-out messages to large numbers of recipients. Amazon SNS makes it simple and cost effective to send push notifications to mobile device users, email recipients or even send messages to other distributed services. Follow below url for more detail......

    https://aws.amazon.com/blogs/aws/push-notifications-to-mobile-devices-using-amazon-sns/