node-gcm icon indicating copy to clipboard operation
node-gcm copied to clipboard

In gcm spec we should respect Retry-After header

Open hypesystem opened this issue 10 years ago • 3 comments

Originally by @ghominejad in #92 (but that contained several issues).

hypesystem avatar Feb 17 '15 15:02 hypesystem

Retry-After is a response header. we can see it in some errors in the 500-599 range. it's a time that we must retry later after that.

https://developer.android.com/google/gcm/server-ref.html

ghominejad avatar Feb 17 '15 16:02 ghominejad

Quoting the relevant section:

Errors in the 500-599 range (such as 500 or 503) indicate that there was an internal error in the GCM server while trying to process the request, or that the server is temporarily unavailable (for example, because of timeouts). Sender must retry later, honoring any Retry-After header included in the response. Application servers must implement exponential back-off.

hypesystem avatar Feb 27 '15 20:02 hypesystem

Quoting the RFC:

The Retry-After response-header field can be used with a 503 (Service Unavailable) response to indicate how long the service is expected to be unavailable to the requesting client. This field MAY also be used with any 3xx (Redirection) response to indicate the minimum time the user-agent is asked wait before issuing the redirected request. The value of this field can be either an HTTP-date or an integer number of seconds (in decimal) after the time of the response.

hypesystem avatar Feb 27 '15 20:02 hypesystem