Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How does whatsapp receive multiple notification when APNS stores only one in case device is offline?

According to the official Apple documentation, APNS (Apple Push Notification Service) stores only the last notification if the device is offline.

Apple Push Notification Service includes a default Quality of Service (QoS) component that performs a store-and-forward function. If APNs attempts to deliver a notification but the device is offline, the QoS stores the notification. It retains only one notification per application on a device: the last notification received from a provider for that application. When the offline device later reconnects, the QoS forwards the stored notification to the device. The QoS retains a notification for a limited period before deleting it.

Then how do apps like whatsapp send messages from multiple users when the device comes online? Those messages would have been received as separate notification if device was online.

like image 892
crysis Avatar asked Aug 21 '15 11:08

crysis


1 Answers

It seems like there was an update to this issue on iOS 8 that will allow your app to wake up in the background due to push even if your user manually killed it. Check this out: Wake your app in the background using PushKit in iOS8.

This means that you can send notifications to your app and once it's re-connected, it will be woken up by the operating system and will be able to communicate with your server. Then, you can implement the logic to send it all of the push messages that were missed while the device was offline.

I have to admit that I have yet to try it out myself, but it sounds like this might be the solution to the issue you're describing.

like image 148
Rony Rozen Avatar answered Oct 07 '22 14:10

Rony Rozen