Redth/APNS-Sharp — Issue #27: Problem with sending push notifications after a break of 2-3 hours.
Author: eyalc82
Created: 2011-12-12 14:41:29+00:00
State: open

I use APNS-Sharp in my server and it works perfect, except in one scenario, I'll try to describe it:

1. Server sends first push - NotificationService successfully connecting to apple servers, i get the "Connecting" and "Connected" events, QueueNotification method returns true, i get the "NotificationSuccess" event and the target device gets the push.
2. Server sending more push notifications - working great the QueueNotification method returns true, i get the "NotificationSuccess" event and the target devices get the push.
3. Server not sending push for few hours (2-3 hours)
4. Server send push - HERE IS MY PROBLEM, after sending this push the QueueNotification method returns TRUE i even get the "NotificationSuccess" event BUT the target device DON'T get the push.
5. Server send another push- the QueueNotification method returns true but this time i get the error event "Error: Unable to write data to the transport connection: An existing connection was forcibly closed by the remote host."
then NotificationService reconnecting to apple servers and we back in step 1. (also the push successfully sent and the target device gets it)

So to sum it up, if my server start sending push notifications and then stop for 2-3 hours, the next push he send after the break doesn't arrive to the target device even though I get the "NotificationSuccess" event and i don't get any error event till i send another push.