Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Receiving error-response packet with enhanced notification format #47

Closed
GoogleCodeExporter opened this issue Apr 27, 2015 · 12 comments
Closed

Comments

@GoogleCodeExporter
Copy link

I modified the code to send enhanced nofitication. As part of testing, I 
intentionally omitted device token in the raw packet, but still i did not 
receive any error packet back. I am using gateway.push.apple.com:2195.

Any thoughts and suggestions?

Many thanks.

Weiping

Original issue reported on code.google.com by wguo1...@gmail.com on 15 Apr 2011 at 7:54

@GoogleCodeExporter
Copy link
Author

As per the Apple spec, the APNService accepts what is sent to it, and nothing 
is returned.

So what error packet would be returned?

Original comment by idbill.p...@gmail.com on 17 Apr 2011 at 4:33

@GoogleCodeExporter
Copy link
Author

For enhanced notification format, "If you send a notification and APNs finds 
the notification malformed or otherwise unintelligible, it returns an 
error-response packet prior to disconnecting. (If there is no error, APNs 
doesn’t return anything.) ". APNs defines status code of 1-8 indicating 
different errors. 

I thought I should receive error response for missing device token, but I got 
nothing back. Just wonder in what kind of situation, error-response can be sent 
back by the APNs. 

Thanks.

Weiping

Original comment by wguo1...@gmail.com on 18 Apr 2011 at 2:27

@GoogleCodeExporter
Copy link
Author

What you are looking for is the Feedback Service:

http://code.google.com/p/javapns/wiki/FeedbackBasicExample

Original comment by idbill.p...@gmail.com on 22 Apr 2011 at 9:18

@GoogleCodeExporter
Copy link
Author

I think Feedback service is another issue. What I am looking for is error 
response, please see:

https://github.com/notnoop/java-apns/blob/master/src/main/java/com/notnoop/apns/
internal/ApnsConnectionImpl.java

Original comment by wguo1...@gmail.com on 23 Apr 2011 at 12:46

@GoogleCodeExporter
Copy link
Author

This appears to be a new feature.

Original comment by idbill.p...@gmail.com on 25 Apr 2011 at 5:18

  • Changed state: Accepted

@GoogleCodeExporter
Copy link
Author

The existing code uses the 'Simple notification format' which does not return 
an error EVER.

See docs at:
http://developer.apple.com/library/ios/#documentation/NetworkingInternet/Concept
ual/RemoteNotificationsPG/CommunicatingWIthAPS/CommunicatingWIthAPS.html

I've tried updating to the 'Enhanced notification format' which is supposed to 
return an error, but I'm unable to get any errors back from the APNS.

With the Enhanced format, the connection isn't being dropped immediately after 
sending data, but I'm not getting anything back from my 
socket.getInputSocket.read() call.

This issue will have to be tabled until I have more time to troubleshoot.

Original comment by idbill.p...@gmail.com on 26 Apr 2011 at 12:44

@GoogleCodeExporter
Copy link
Author

Thanks a lot for looking into it. I got the same result as yours. Maybe it has 
something to do with Apple Gateway. 

Weiping

Original comment by wguo1...@gmail.com on 26 Apr 2011 at 1:04

1 similar comment
@GoogleCodeExporter
Copy link
Author

Thanks a lot for looking into it. I got the same result as yours. Maybe it has 
something to do with Apple Gateway. 

Weiping

Original comment by wguo1...@gmail.com on 26 Apr 2011 at 1:04

@GoogleCodeExporter
Copy link
Author

Original comment by sype...@gmail.com on 9 Sep 2011 at 7:20

  • Changed title: Receiving error-response packet with enhanced notification format

@GoogleCodeExporter
Copy link
Author

Re-labeling as an enhancement request.   

IMHO, since the library itself makes it difficult to push malformed 
notifications (validates tokens before push, JSON payload is generated 
programmatically, etc.), I believe the need for this is less relevant than if 
one were to write JSON payloads manually and then be more susceptible to 
payload format or content errors.  Still, it would be interesting to have 
support for this in a later version, even though the probability of receiving 
anything other than NO_ERROR is quite low because of how the library shields 
you from building invalid payloads.

Original comment by sype...@gmail.com on 14 Sep 2011 at 4:31

  • Added labels: Priority-Low, Type-Enhancement
  • Removed labels: Priority-Medium, Type-Defect

@GoogleCodeExporter
Copy link
Author

Update:  javapns 2.0 Beta 4 includes full support for streaming messages with 
the enhanced notification format.  This was the first step in adding support 
for error packets.  

Additional note:  after review of 1.x code, it appears that the library did 
include a preliminary attempt at supporting error packets (this is what was 
freezing the library in the sendNotification method in 1.6).  However, the code 
never worked because it was executed within the same thread, instead of being 
delegated to a monitoring thread that is not blocking the notification thread.  
More work needs to be done to recover, adapt and enhance that code to support 
the requested feature.

Original comment by sype...@gmail.com on 15 Sep 2011 at 7:29

@GoogleCodeExporter
Copy link
Author

Fixed in 2.0 Beta 5.

Details: 
All push methods now return response-enabled notification results (as 
javapns.notification.PushedNotification objects).  The new error-response 
packet reader automatically updates PushedNotification objects at the end of a 
connection so that you can find out what a transmission error was, if any 
occurred.

Original comment by sype...@gmail.com on 27 Sep 2011 at 1:20

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant