iphone & notifications : max number of notifications?
I have an iPhone app sending notifications and everything is working fine... Except sometimes :)
Let me explain : I'm using a pretty simple PHP script to send the notifications (using the stream_context_create
method) but some users told me they do not receive some notifications. Apparently, I may encounter some cases where I need to send up to 50,000 notifications within a minute and I think this might be the problem. I'm using one single stream to send all the notifications.
Did any of you guys encountered such an issue? Do I need to split in several streams? Is there any info about the max number of notifications I may send in a stream?
Thanks :)
Edit 1
"Speed" is not the issue he开发者_Python百科re : I am able to push all my notifications to Apple within a minute (I may have some issues in the future if my number of users growns but it's OK ATM). The problem I see here is that Apple may consider me a spammer or something and does not deliver all my 50,000 notifications :/ Do you guys have any idea how I can get sure about that?
I asked an Apple developer representative about this and was told there were no rate limits and that the system had never dropped a notification.
(This was 12 months ago, when Push was still relatively new, so they may have changed policies since then)
I would rather develop the code to send the notifications in C. PHP, being a scripting language, can not (probably) guarantee the required speed to handle 50K notifications per minute. Moreover, you may need a very hugely provisioned server with latest generation CPUs and a lot of memory. Indeed, to meet the QOS you require, you must be able to send about 14 notification per second. I doubt PHP is actually able to cope with this rate.
In the past I had my own provider, and my QOS was much less than the one you require. Then I decided to switch to a commercial service provider, Urban Airship. I have found this service works like a charm. None of the users have - ever - reported a missing notification. You have to pay for it, but handling this stuff by yourself may prove to be an incredible hassle.
If there is a failure in the notification stream (i.e. bad token), then a few tokens proceeding it are missed. This has been my experience, so I send one token at a time. No more failures, other than the one bad token.
I have run into exactly the same issue, but with far fewer pushes per stream. In my case, I pushed all my messages, about 250, on the same stream, and none would be delivered. It does appear that a bad token seems to cause the failure, but so far I'm not certain what constitutes a bad token.
I've read elsewhere that pushing messages using the distribution tokens in a sandbox environment and pushing messages using sandbox tokens in the distribution environment can cause a stream to fail, but I've mixed tokens in both environment and haven't missed messages, but I was only pushing a few messages in one stream at the time.
Long story short: I'm pushing one message per stream, and it works fine. It takes on the order of seconds to push 250 messages, which seems terribly inefficient, but its just a minor nuisance to me.
精彩评论