gpt4 book ai didi

php - 苹果推送通知问题

转载 作者:塔克拉玛干 更新时间:2023-11-02 10:09:51 24 4
gpt4 key购买 nike

我真的不知道怎么问这些,但希望我能说清楚让你明白我的问题

  1. 消息限制为 256。但是我需要对哪个消息施加此限制?一开始我以为是指json大小。但是在查看了 zend 使用的代码和其他使用推送通知的代码之后,其他信息是通过有效载荷发送的(json 是 256,但发送的有效载荷是 270)。我应该将 json 限制为 240 或更少吗?

  2. 如果多个消息具有相同的 Id(我说的不是设备 id)会怎样

  3. 向同一台设备发送第二条消息的速度有多快?我有一些问题,只有一条消息到达。

我对 Id 使用时间戳,所以我想知道这是否是我的问题的原因,或者我可能无法在同一秒内向单个设备发送 5 条消息。

最佳答案

来自 Apple Developer site :

The Notification Payload

Each push notification includes a payload. The payload containsinformation about how the system should alert the user as well as anycustom data you provide. The maximum size allowed for a notificationpayload is 256 bytes; Apple Push Notification Service refuses anynotification that exceeds this limit.

限制是完整的有效负载,这意味着 JSON + 您的消息。因此,您的消息应限制在 236 个字符以内,然后添加以下 JSON 的字符数:{"aps":{"alert":""}}

how fast can i send a second message to the same device? I have some problems that only 1 message arrives.

向一台设备发送消息没有限制。但是,Apple 不保证发送您的所有消息,并且 APNS 可能只发送设备的最新推送通知消息,以防从一个应用程序接收到发往同一设备的多条消息。

来自 iOS Developer Library :

Some Notifications Received, but Not All

If you are sending multiple notifications to the same device or computer within a shortperiod of time, the push service will send only the last one.

Here's why. The device or computer acknowledges receipt of eachnotification. Until the push service receives that acknowledgment, itcan only assume that the device or computer has gone off-line for somereason and stores the notification in the quality of service (QoS)queue for future redelivery. The round-trip network latency here is ofcourse a major factor.

As described in the Local and Push Notification Programming Guide, theQoS queue holds a single notification per app per device or computer.If the service receives another notification before the one in thequeue is sent, the new notification overwrites the previous one.

感谢Joachim Isaksson提供以上链接。

关于php - 苹果推送通知问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16960855/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com