I have coded Push Notifications (APNS, Apple Push Notification Service) for an iPhone App with PHP. Everything is working fine while no app is deleted from a device. I use the Feedback Service from Apple do get the deleted devices. If I get devices I mark them as INACTIVE in my database to send no further push notification to those devices.
The problem is that Apple is slow. If you delete the app from your device a request is send to Apple and I collect the devices by using the Feedback Service. But Apple is not forwarding the inactivated devices instantly so I get the following error because I can't send push notifications to a inactive device:
PHP Warning: fwrite(): SSL: Broken pipe in apns.php on line 155
My Feedback Service script runs every 5 minutes but the update from Apple comes every 10-15 minutes. If I send a push notification within the 10-15 minutes the above error appears because in the database the device is still marked as ACTIVE and on the Apple server the device is marked as INACTIVE.
There is no problem to connect to the Feedback Service or to the Push Service but I don't always get devices from the Feedback Service.
Greets, TheFox