AWS SNS Endpoint getting disabled on its own

老子叫甜甜 提交于 2019-12-04 12:47:11

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

  1. GCM and APNS can disable your device's endpoint, based on some cleanup policy. In other words, the devices are subjected to change in their endpoints and is not in control of AWS.
  2. When GCM disables your device endpoint, then it create a mapping between the new endpoint and the old endpoint. Using this mapping, it is still able to serve notifications via the old endpoint. But, this mapping is there for a short while only. Once, this mapping is gone, the notifications start to fail. Also, while the mapping is there, the GCM provides a warning message to SNS, that the endpoint will soon be disabled and also provides the new endpoint, but it only gets logged.

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

  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.

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