• 苹果通知推送服务(APNS)关键特性摘要


    1. 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.

    假如用户手机不在线。可能没有信号或者关机吧。APNs会存储转发。等用户在线时再发送

     

    2.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.

    假设用户不在线,通知会合并,仅仅会保留最新的一条。

    假如你给用户发了两条通知,但用户反馈说。仅仅收到了一条,那么非常可能是用户当时不在线,APNs的合并策略生效。仅仅保留了近期一条

     

    3.If the device remains offline for a long time, any notifications that were being stored for it are discarded

     

    4.The maximum size allowed for a notification payload is 256 bytes; Apple Push Notification Service refuses any notification that exceeds this limit.

    这个非常重要。payload。就是最后生成的那段Json。不得超过256字节。

    假设超过了,建议去掉一些不须要的參数,把alert,就是提示信息的字数降低

     

    5.don’t repeatedly open and close connections. APNs treats rapid connection and disconnection as a denial-of-service attack.

    6.If you send a notification that is accepted by APNs, nothing is returned.

    发送成功的木有返回,仅仅有发送失败的才会返回

     

    7.If you send a notification that is malformed or otherwise unintelligible, APNs returns an error-response packet and closes the connection. Any notifications that you sent after the malformed notification using the same connection are discarded, and must be resent.

    这条非常重要,假设有error-response,那么这条之后的通知都须要重发。有非常多开源的库。在发苹果通知时都没有检測error-response,假设你不小心用了。那么用户非常可能反馈“怎么没有通知啊”

     

    8.The notification identifier in the error response indicates the last notification that was successfully sent(实际情况不是,实际上返回的是出错的那条通知的ID). Any notifications you sent after it have been discarded and must be resent.When you receive this status code, stop using this connection and open a new connection.

    这是对上一条的补充。假设出错了,须要关闭当前的连接,而且又一次连接再发。error-response中返回的通知ID。能够帮助我们找出哪条出错了,这样就能知道哪些须要重发了

     

    9.When a push notification cannot be delivered because the intended app does not exist on the device, the feedback service adds that device’s token to its list.

    APNS的feedback service会返回那些已经卸载的设备的token--device_token。存储这些token。下次就不用再给他们发了,能够节省点资源。须要注意的是:feedback的接口读取一次,APNS就会清空它的列表。下次再读取时,返回的就是这两次读取之间这段时间新产生的device_token。

     

    仅仅有把这些搞清楚。才方便我们理解苹果推送的规则,知道自己推送上的一些不足之处
  • 相关阅读:
    Linux命令行和Shell高效率使用方法
    PHP导出word,CVS,PDF
    PHP的CLI综合
    [PHP]算法-二叉树中和为某一值的路径的PHP实现
    [PHP]算法- 判断是否为二叉搜索树的后序遍历序列的PHP实现
    [PHP]算法- 二叉树的深度的PHP实现
    [PHP] 算法-镜像二叉树的PHP实现
    [PHP] 算法-二叉树的子结构判断的PHP实现
    [PHP] 算法-邻接矩阵图的广度和深度优先遍历的PHP实现
    [PHP] 算法-根据前序和中序遍历结果重建二叉树的PHP实现
  • 原文地址:https://www.cnblogs.com/yjbjingcha/p/8321866.html
Copyright © 2020-2023  润新知