Apple 推送通知:发送大量消息 [英] Apple Push Notification: Sending high volumes of messages

查看:36
本文介绍了Apple 推送通知:发送大量消息的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用 PHP 连接到 apn 以向多个设备发送一些通知,尽管这个问题更具概念性,因此它不必特定于 PHP.

I am using PHP to connect to apns to send some notifications to multiple devices, although the question is more conceptual so it doesn't have to be specific to PHP.

我将同时发送到大约 7000 台设备(并且还在不断增加).我的进程每天运行一次并向所有设备广播,因此我不会经常重新打开连接.

I will be sending to about 7000 devices (and growing) all at the same time. My process runs ONCE per day and broadcasts to all devices, so I am not constantly re-opening a connection.

目前我可以轻松地一次发送到 2 个设备,并且消息将成功传递.但是,当我尝试向全部 7000 台设备发送消息时,消息似乎无法传递.

Currently I can easily send to 2 devices at a time and the messages will successfully deliver. However when I attempt to send to the full 7000 devices, the messages do not seem to deliver.

我的代码的伪逻辑是:

open connection to apple
loop over device-tokens
    write to socket connection per device
end loop
close connection to apple.

我在某处看到我应该只执行一次写入,并构建一个巨大的主体,换句话说,伪代码如下所示:

I have seen somewhere that I should only perform a SINGLE write, and construct one huge body, in other words the pseudo-code would look like:

loop over device tokens
    create payload aggregating all devices
end loop
open connection to apple
write to socket ONCE with whole payload for 7000 devices
close connection

很难测试,因为我显然不能用测试消息向我的 7000 名生产用户发送垃圾邮件.有没有其他人遇到过类似的问题?

It's difficult to test as I obviously can't spam my 7000 production users with test messages. Has anybody else had a similar problem?

谢谢

推荐答案

我听说苹果确实关心你与他们的服务器建立的连接的数量,但我从来没有听说过任何写限制.此外,我不确定您会在这里收到什么样的回复,但可能值得一试,看看会发生什么.也许试验沙箱推送通知服务器,只使用生产设备的设备令牌.这些手机不应收到发送到沙盒服务器的任何推送通知,如果沙盒报告已成功交付",那将是一种无忧的测试方式.

I've read that apple does care about the number of connections you make to their servers but I've never heard about any write limits. Also, I'm not sure about what kind of response you'd receive here, but it might be worth a try to see what happens. Maybe experiment with the sandbox push notification server, only using the device tokens of the production devices. Those phones should not receive any push notifications sent to the sandbox server and if the sandbox reports "delivered successfully", that would be a worry-free way to test.

这篇关于Apple 推送通知:发送大量消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆