在短时间内发送多条消息时,TOPICS_MESSAGE_RATE_EXCEEDED [英] TOPICS_MESSAGE_RATE_EXCEEDED when sending more than one message in a short period of time

查看:397
本文介绍了在短时间内发送多条消息时,TOPICS_MESSAGE_RATE_EXCEEDED的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我有三个Android设备,我试图发送多个下游消息在短时间内(一秒钟)到一个主题(三个设备订阅)。我们的服务器为它们中的三个确认ACK。

在那一刻,我们发送了两个消息到主题,但是其中一个返回了NACK,错误消息是 TOPICS_MESSAGE_RATE_EXCEEDED



现在,我们再次重新发送消息,如果 time_to_live 不会先到期。在我们的情况下,当用户再次点击该消息时,该消息再次尝试重新发送。这是正确的行为?



以前有没有人有这个问题?如何解决?

解决方案

这是GCM / FCM的预期行为。在短时间内发送多个邮件到一个主题将导致这个错误。我认为这是一个安全网络为GCM / FCM针对泛滥,也是关于处理流量。想象如果您有1000个订阅者,那么您可以在不到一秒的时间内发送多个邮件给该主题。您应该实现一个延迟(约5-10秒)发送给主题的每条消息。



还提到@ Eran的回答这里(它基于 $ b


主题消息速率已超过消息给订阅者的速率到一个特定的话题太高了。减少为此主题发送的消息数量,不要立即重新发送。



I need to send more than one message to a single topic in just one second.

I have three Android devices and I'm trying to send multiple downstream messages to a topic (the three devices are subscribed to) in a short period of time (one second). Our server does ACK for the three of them.

In that moment, we send two messages to the topic, but one of them returns NACK with an error message of TOPICS_MESSAGE_RATE_EXCEEDED.

And now, we retry to resend the message again, if time_to_live doesn't expire first. In our case, that message tried re-sending again when the user clicks on it again. Is this the correct behavior?

Did anyone have this problem before? How is it solved?

解决方案

This is the expected behavior for GCM/FCM. Sending multiple messages to a topic in a short amount of time will cause this error.

I think this serves as a safety net for GCM/FCM against flooding and is also about handling the traffic. Just imagine if you have a 1000 subscribers then you send multiple multiple messages in less than a second to that topic.

You should implement a delay (about 5-10 seconds) for each message you send to the topic.

Also mentioned by @Eran's answer here (which is based from the docs):

Topics Message Rate Exceeded The rate of messages to subscribers to a particular topic is too high. Reduce the number of messages sent for this topic, and do not immediately retry sending.

这篇关于在短时间内发送多条消息时,TOPICS_MESSAGE_RATE_EXCEEDED的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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