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

Using ErrorResponse class for handling specific errors #95

Open
qd3v opened this issue Feb 28, 2015 · 3 comments
Open

Using ErrorResponse class for handling specific errors #95

qd3v opened this issue Feb 28, 2015 · 3 comments

Comments

@qd3v
Copy link

qd3v commented Feb 28, 2015

I found this class but can't find it using somewhere in the code. The reason I'm asking is Apple recommendation:

Note: The Apple Push Notification service (APNs) provides feedback to your server which may require specific actions. For example, if APNs tells you that a push token is invalid, remove that device and its registrations from your server

This is what that class is responsible for - tell me exactly what error was happened, so I can decide should I destroy registration of device or not.

Please, make this moment clear for me. Am I missed something or there is a way to use this class somehow?

@nathany
Copy link

nathany commented Apr 21, 2015

I'm wondering the same thing.

My guess is that it should be used in pusher.rb after writing to the connection.

The thing is, I don't think the response from Apple is synchronous. The docs are a bit confusing, because the table suggests that 0 is returned when no error occurs, but elsewhere it says:

"If you send a notification that is accepted by APNs, nothing is returned."

And if there is an error response, Apple hangs up.

APNs returns an error-response packet and closes the connection

It looks like Grocer will retry 3 times by default (see connection.rb with_connection), but it doesn't appear to read off the connection to determine the ErrorResponse.

@nathany
Copy link

nathany commented Apr 21, 2015

@stevenharman
Copy link
Member

You are correct - we have an ErrorResponse class, but don't currently use it. In #14 you'll find a lengthy discussion and several proposed solutions for not dropping messages and also reading the error response. The most promising would be adding a producer/consumer queue, with a ring buffer to hold sent messages. This would allow us to continue to write at high speeds, but not block while waiting an arbitrary amount of time for an error message from APNS.

None of the original authors currently have available time to undertake the changes, but would be happy to work with any individuals who wish to.

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

No branches or pull requests

3 participants