AWS SNS Endpoint自行禁用 [英] AWS SNS Endpoint getting disabled on its own

查看:207
本文介绍了AWS SNS Endpoint自行禁用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经设置了Android和iOS应用程序,以便能够通过SNS接收通知.设置工作正常,设备确实收到了通知.但是后来,通知开始失败.

I have setup my Android and iOS app to be able to receive notifications via SNS. The setup is working fine and the device do receive the notifications. But later on, the notification starts to fail.

我已经为成功和失败方案启用了日志记录.根据日志,我一直收到以下形式的错误:端点已禁用:arn:aws:sns:myRegion:myAccount:endpoint/GCM/myApp/myDeviceEndpointHash"

I have already enabled logging for both success and failure scenarios. And according to the logs, I keep receiving errors of the form: "Endpoint is disabled:arn:aws:sns:myRegion:myAccount:endpoint/GCM/myApp/myDeviceEndpointHash"

我知道该错误意味着该端点已被禁用.另外,我知道通过控制台和API重新启用端点的方法.

I know the error means that the endpoint is disabled. Also, I am aware of the methods of re-enabling the endpoint via console and API.

我的问题是为什么这种情况持续发生.这是我将通知推送到的设备的99%发生的情况.预先感谢.

My question is why this keeps on happening. This is happening with 99% of the device I am pushing the notifications to. Thanks in advance.

推荐答案

与AWS支持团队进行了长时间的交谈之后,出现了几件事.

After a long conversation with the AWS support team, there were a couple of things that surfaced.

  1. GCM和APNS可以基于某些清理策略来禁用设备的终结点.换句话说,这些设备的端点会发生变化,并且不受AWS的控制.
  2. 当GCM禁用设备端点时,它将在新端点和旧端点之间创建映射.使用此映射,它仍然能够通过旧端点提供通知.但是,此映射仅存在一小段时间.一旦此映射消失,通知将开始失败.另外,当存在映射时,GCM会向SNS提供警告消息,该端点将很快被禁用,并提供新的端点,但只会被记录.

现在,该怎么办?该解决方案包括两个部分:

Now, what to do? The solution has two parts:

  1. 每当您的应用启动时,您都会为其创建一个新的端点,并进行 排除此设备的整个SNS注册过程.这引起 使用最新设备端点更新的SNS存储库 由GCM提供.
  2. 让我们说用户长时间没有启动应用程序.然后,您可以将Lambda放在SNS日志中,使用此方法 您可以确定Lambda,何时将禁用端点. 对于此事件,您可以向设备推送静默通知,然后 那么您的设备必须静默在SNS上重新注册自己.
  1. Whenever your app starts, you create a new endpoint for it, carry out the entire SNS registration process for this device. This causes the SNS repository to be updated with the latest device endpoint provided by GCM.
  2. Let's say the user has not started the app for a very long duration. Then, you can place a Lambda on the SNS logs, using this Lambda you can determine when the endpoint is about to be disabled. For this event, you can push a silent notification to the device and then your device must re-register itself on SNS silently.

第二步涉及服务器和设备方面的大量工作.最后,我们决定不实施它,因为对于大多数用户而言,它不会发生,并且所涉及的工作也无法证明其合理性.

This second step has a lot of work involved, both on server and device side. In the end, we decided not to implement it since it does not happen for majority of users and the work involved could not be justified.

这篇关于AWS SNS Endpoint自行禁用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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