async error response (response time varies) => errors not guaranteed to be caught if wait for a fixed time
success do not response => cannot wait for response forever
async close write stream connection after error-response
all message sent after failed msg error are discarded, error-response and write conn close will delay => should be re-sent
sometimes APNS close arbitrary
From my experiment of getting error-response with enhanced message format:
if wait for error-response(using select.select()) with given timeout = 0s, it often get NO APNS's error-response in time,
when I set to 0.3s it got 90% of error-response.
however, it's not guarantee 100% to get error-response for every failed notification, the network connection might also be a factor of delayed time.
Possible Solution
The solution suggested in the problem is to save sent notification in a queue with no timeout(or minimum), when error-response caught, pop out messages before the error one in queue (considered successfully sent), and re-sent others.
Which will not have performance concern if waiting for error-response in fixed time for each message sent, and also prevent error-response uncaught.
The problem of current APNS error-response are: (reference: the problem, official doc -> The Binary Interface and Notification Format)
From my experiment of getting error-response with enhanced message format:
Possible Solution
The solution suggested in the problem is to save sent notification in a queue with no timeout(or minimum), when error-response caught, pop out messages before the error one in queue (considered successfully sent), and re-sent others. Which will not have performance concern if waiting for error-response in fixed time for each message sent, and also prevent error-response uncaught.