Avoiding Duplicates Using Apple Push Notification Service (APNS)

We referenced Apple TN2265 ( https://developer.apple.com/library/ios/technotes/tn2265/_index.html ) to implement error handling in our application, which sends push notifications to our users. The documentation assumes that we process errors asynchronously, in particular:

If you get six bytes back, an error response that you can check for the response code and the identifier of the notification that caused the error. You will need to send all notifications after this again.

It happens that in the sequence of notifications, if someone does not respond, all subsequent notifications, allegedly, did not work? If not, how can I avoid duplicating the sending of the same notification to this device?

+4
source share
1 answer

Yes, in this case, all notifications following it are guaranteed not even to be processed by the APNS server.

When APNS detects an invalid message, it writes the error response to the socket and closes the connection. Until you get an error response, you may have already sent more Apple messages to the same socket. All of them will not reach Apple. Once you create a new socket, you must send it all.

There is a risk of duplication.

+2
source

All Articles