GCM推送通知会导致502错误的网关 [英] GCM push notifications cause 502 Bad Gateway

查看:137
本文介绍了GCM推送通知会导致502错误的网关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个.Net Windows服务,通过 https://android.googleapis.com/gcm/send

该服务以10 /秒的速率周期性地发送大约10,000条消息的批处理。对于每批,5到10条消息将导致502错误网关响应。产生502的消息总是经过第二次尝试。



这是正常的吗?我可以发送太多的消息吗?

根据 GCM指南,所有5xx错误代码都应该被视为临时错误,并且应该重试获取这些错误的请求:


5xx 500-599范围内的错误(例如500或503)表明GCM服务器在尝试处理请求,或者服务器暂时不可用(例如,由于超时)。发件人必须稍后重试,并遵守响应中包含的任何Retry-After标题。应用程序服务器必须实现指数后退。


我认为每秒消息不会太快。只要你的代码处理这个错误并重试,我不认为应该有任何问题。


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?

解决方案

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.

这篇关于GCM推送通知会导致502错误的网关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆