我正在使用 APNS python 包装器库发送推送通知。 Apple 文档说消息的有效负载限制为 256 字节。但是由于一个请求可以发送多个PN,我想知道同一个请求中允许的消息数量是否有限制?
发送大量(1000+)推送通知的正确方法是什么? Apple 服务器是否限制连接数/秒或 PN/秒以避免垃圾邮件?
最佳答案
正如 Jonathan 在他的评论中所说,Apple 没有在 APNS 文档中指定限制。
由于您通过 TCP 连接将通知作为二进制数据发送,因此在单个请求中发送的通知数量取决于 TCP 缓冲区的大小。
您不必为每个请求发送一个通知。我不确定在这种情况下单个请求一词是否有意义(因为它们不会为发送的每个通知返回响应)。 Apple 鼓励您尽可能长时间保持连接打开。只要它是打开的,你可以写任意多的字节(属于多个推送通知)。
编辑:
Apple 最近编辑了他们的 technical note regarding push notifications :
Push Notification Throughput and Error Checking
There are no caps or batch size limits for using APNs. The iOS 6.1 press release stated that APNs has sent over 4 trillion push notifications since it was established. It was announced at WWDC 2012 that APNs is sending 7 billion notifications daily.
If you're seeing throughput lower than 9,000 notifications per second, your server might benefit from improved error handling logic.
关于iphone - iOS:一次请求可以发送多少条推送通知?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15601243/