It's been now a week that I am searching answers for the problem I have, but I can't find anything, so I am going to ask the question here!
I made an iPhone application that can send notifications to the users. So, I have a notification server, coded in PHP, and which uses apns-php (http://code.google.com/p/apns-php/)
My server can send notifications at any time, so I have a worker that runs indefinitely, and each time it receives a notification to send (the notifications to send are in a queue), it sends the notification. To be the fastest possible, the worker has 10 threads that can send notifications.
When I start the worker, I receive the notifications I am suppose to receive.
The problem is that after a while (I don't know if it is after a specific amount of time or a specific amount of notifications sent ... or something else!), I do not receive any new notification. And when I look at the logs of apns-php, there is nothing : all the messages seem to be sent to the APNS service, with no error (apns-php uses the enhanced format). Once I restart the worker, I receive notifications again (but only for a while).
I've searched for this problem in stackoverflow and on Google, and so far, the only responses I saw were:
- There is a problem in the certificate/profile used. I know that can't be the problem, because I receive the notifications when I start the worker
- There are some development device tokens in our database, which makes APNS close the connection. Indeed, it is possible that some development device tokens are present in our database, but when I look to the apns-php code, if the connection is closed, a new one is opened. So I don't understand how can this impact all the notifications sent after a bad device token.
This problem is really driving me crazy, because the notifications are really important for our service. So if anyone has an idea of what could be the problem here, it would really be a life saver!
PS: I haven't posted any code because there isn't anything specific that I'm doing. I'm just using the send() function of apns-php for each notification to send.