endyman/pyapns — comment on commit b89c089d2c6c2e53734470752b3e951c9321c978
File:  line 0
By endyman:

Yes - the Enhanced notification format allows to set a custom 4 byte identifier which is used to in error-response packets as described in the "Provider Communication with Apple Push Notification Service" document:

https://developer.apple.com/library/mac/#documentation/NetworkingInternet/Conceptual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html#//apple_ref/doc/uid/TP40008194-CH101-SW1

As you can't distinguish prod and dev tokens, it is hardly impossible to ensure, that a production subscription backend which interfaces pyapns is never ever provisioned with sandbox tokens. (common root causes: developer forgot to change dev/ prod url, signing errors using wrong certificate etc ....) I think it is quite important to deal with such tokens and from my perspective due to the asynchronous nature of APNS the enhanced format is the only option to identify a root cause for a connection drop.