Notification 掉包

Google Cloud MessagingApple Push Notification Service 對於發佈推撥期間裝置離線的處理,都採以下政策:


引用 GCM:
GCM will usually deliver messages immediately after they are sent. However, this might not always be possible. For example, the device could be turned off, offline, or otherwise unavailable. In other cases, the sender itself might request that messages not be delivered until the device becomes active by using the delay_while_idleflag. Finally, GCM might intentionally delay messages to prevent an application from consuming excessive resources and negatively impacting battery life.
GCM Advanced Topics, Setting an Expiration Date for a Message
引用 APNS:
If APNs attempts to deliver a notification but the device is offline, the notification is stored for a limited period of time, and delivered to the device when it becomes available. 
Only one recent notification for a particular application is stored. If multiple notifications are sent while the device is offline, each new notification causes the prior notification to be discarded. This behavior of keeping only the newest notification is referred to as coalescing notifications. 
If the device remains offline for a long time, any notifications that were being stored for it are discarded.
Local and Push Notification Programming Guide, Quality of Service


比較 Naver LINE Android 和 iOS 版本對於離線訊息的處理,一旦接上網路,離線訊息一併收到數則。猜測可能的作法是:

1. Device offline
2. Send #1 msg, server enqueue 1 msg
3. Send #2 msg, server enqueue 2 msgs
4. Device online
5. Server send queue
6. Device splits msgs and local notificate one-by-one.