开发者

Apple Feedback Service (APNS) is slow

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


Answer from Apple.com Developer Forum (https://devforums.apple.com/thread/114446):

Your server needs to detect disconnections and reconnect if necessary. Nothing is "instant" when networking is involved; there's always some latency and code needs to take that into account. Also, consider using the enhanced binary interface so you can check the return response and know why the connection was dropped. The connection can also be dropped as a result of TCP keep-alive, which is outside of Apple's control.

So I'm gonna set all devices to INACTIVE if the server detects a disconnection.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜