views:

331

answers:

2

Hi

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.

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.

The psuedo-logic to my code is:

open connection to apple
loop over devicetokens
    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 psuedo-code would look like:

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

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?

Thanks

+1  A: 

Have you considered using Urban Airship?? I understand you are looking for getting your current implementation working, but Airship gives you up to 250,000 free pushes a month, and if you only push 7000 a day you'll still have 33,000 left over at the end of each month.

Pyro2927
+1  A: 

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.

jtrim
way overdue. but your answer was essentially correct. thanks :)
BoomShaka