Reputation: 1953
I am sending notifications to apns one after the other just to test it. For example I send 20 notifications. Each time I send, a counter is incremented and its value is added to the beginning of the title in order to track delivery. The phone receives the first 5 and the 16th but none else.
I am not getting an error for any of them from the apns. They all receive success response.
Why could this be?
EDIT (some extra info):
I am communicating directly with https://api.push.apple.com. I am using http2 and jwtToken. And as suggested, I am keeping the connection alive.
EDIT2:
Device is not offline during this period.
Upvotes: 1
Views: 657
Reputation: 21
If you send multiple notifications for the same bundle ID while APNs can’t deliver the notifications, APNs preserves only one of the accepted push notifications.
As you can see, the notifications you send using the same bundle ID can overwhelm each other even if they are waiting for a short time in APNs persistent storage.
In this case, you will not get any error message. Also, APNs do not queue up to send pending notifications. It can send randomly.
Upvotes: 0
Reputation: 393771
Well, if you send the notifications in a short time period, some may be discarded, especially if the device was temporarily offline when some of the notifications were sent.
Apple Push Notification service includes a Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification and the destination device is offline, APNs stores the notification for a limited period of time and delivers it when the device becomes available again. This component stores only the most recent notification per device and per app. If a device is offline, sending a notification request targeting that device causes the previous request to be discarded. If a device remains offline for a long time, all its stored notifications in APNs are discarded.
(Source)
Your app should never depend on all the notifications being delivered.
Upvotes: 2