I have an iPhone application that receives notifications from Apple Push Notification Service. I am using (Easy APNS for PHP) to push the notifications using a Cron job that runs every 15 minutes.
I have around 400 devices registered that are using my App.
The Problem:
when i want to send a new notification to my users, they receive the notification many times, and it’s always the same. I don’t know why Apple is sending the same notification many times (like 5 or 6 times)
some extra info:
- Easy APNS works by fetching 100 messages at a time (like a batch), so i guess that it takes 1 hour to send the 400 messages to all my users.
- In my apns_messages table, the message has only one entry for each device, so there are no repeated messages in theory. Seems like the same entry is being processed many times.
I can’t find the reason why am i receiving the same notification so many times. Also this is annoying for the users.
Ok i found out what happened.
The EasyAPNS grabs 100 messages and loops through them. In each loop, y connects to the two Apple Services (push notification service and feedback service). In my server, the firewall was blocking the port for Feedback service making a timeout when trying to connect to it. So php execution crashed, and the message was left as ‘queued’ when it was already sent. So the same message was being processed many times!