GCM push notifications cause 502 Bad Gateway

五迷三道 提交于 2020-02-01 03:31:08

问题


I have an .Net windows service that sends GCM push notifications via https://android.googleapis.com/gcm/send.

The service periodically sends batches of approximately 10,000 messages at a rate of 10 / second. With each batch, 5 - 10 of the messages will cause a "502 Bad Gateway" response. The messages that generate the 502 always go through with a second try.

Is this normal? Could I be sending too many messages too quickly?


回答1:


According to the GCM guide, all 5xx error codes should be treated as temporary errors, and requests that get these errors should be retried :

5xx 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.

I don't think 10 messages a second is too quick. As long as your code handles this error and retries, I don't think there should be any problem.



来源:https://stackoverflow.com/questions/18060968/gcm-push-notifications-cause-502-bad-gateway

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!