webpro2 / javapns

Automatically exported from code.google.com/p/javapns
0 stars 0 forks source link

First notification do not come to device #19

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I've found a problem- when my script is running (and keeping connection with 
apns server) for a several hours without sending any notification, when I do 
first sendNotification - it says "Attempt failed... trying 
again" (PushNotificationManager.java line 152), and then send notification 
(second attempt). But problem is what this notification DO NOT get to 
device. Second and others- all ok. 

Original issue reported on code.google.com by a.baigo...@gmail.com on 19 May 2010 at 9:04

GoogleCodeExporter commented 9 years ago
This is probably not the answer you want... 

"Don't maintain a 24x7 connection to the APNServers... maintaining connections 
is bad and will probably get 
your key revoked."

Say there are 100 connections available to the APNServers, and there were 100 
iPhone app servers connected 
to the APNS 24x7, then NO ONE else would be able to send messages. 

Or do you think Apple should provide 1 connection for every app ever built?

The retry code may have issues, but what you are doing is still wrong.

Bill

Original comment by idbill.p...@gmail.com on 20 May 2010 at 8:24

GoogleCodeExporter commented 9 years ago
Thank you for reply, but where you found what "maintaining connections is bad 
and 
will probably get your key revoked"? Apple documentation says: 

"The provider connects with APNs through a persistent and secure channel while 
monitoring incoming data intended for their client applications. When new data 
for 
an application arrives, the provider prepares and sends a notification through 
the 
channel to APNs, which pushes the notification to the target device." 
and 
"You should also retain connections with APNs across multiple notifications. 
APNs 
may consider connections that are rapidly and repeatedly established and torn 
down 
as a denial-of-service attack. Upon error, APNs closes the connection on which 
the 
error occurred.". 

Original comment by a.baigo...@gmail.com on 21 May 2010 at 8:12

GoogleCodeExporter commented 9 years ago
Yes, 'You should also retain connections with APNs across multiple 
notifications.' But that doesn't mean hold 
open the connection unused for hours at a time.

Original comment by idbill.p...@gmail.com on 21 May 2010 at 3:28

GoogleCodeExporter commented 9 years ago

Original comment by idbill.p...@gmail.com on 16 Oct 2010 at 9:37