Apple 推送通知:发送大量消息 [英] Apple Push Notification: Sending high volumes of messages
问题描述
我正在使用 PHP 连接到 apns 以向多个设备发送一些通知,尽管这个问题更具概念性,因此它不必特定于 PHP.我将同时发送到大约 7000 台设备(并且还在不断增加).我的进程每天运行一次并向所有设备广播,因此我不会经常重新打开连接.
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. 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.
open connection to apple
loop over device tokens
create payload aggregating all devices
end loop
write to socket ONCE with whole payload for 7000 devices
close connection
我可以像上面的伪代码那样做吗?
Can I do like above pseudo-code?
推荐答案
正确的做法是,
you can open the connection.
perform as many writes as you like.
just make sure you check the connection status after each write
close the connection.
由于每次写入都被视为特定于设备的消息,因此您一次只能写入一条消息.但是您可以打开一个连接并尽可能多地写入.
As each write is considered as a message specific to device, you can write one message at a time. But you can open a connection once and write as many you can.
这篇关于Apple 推送通知:发送大量消息的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!