英文:
Send a push notification to a specific APNS token using AWS SNS
问题
我正在尝试使用AWS SNS向特定的APNS令牌发送基本的APNS推送通知。我找到的所有示例都是关于如何将令牌存储在SNS中、订阅频道和发布到频道。
我不需要在我构建的应用程序中使用那种方式。Golang应用程序会决定将推送发送给哪些用户以及针对哪些操作。然后它会在数据库中查找这些用户的令牌。我只需要一个基本的请求来向该令牌发送推送通知(最好是异步的)。
这是我查看的一个示例:
http://docs.aws.amazon.com/sdk-for-go/api/service/sns/SNS.html#Publish-instance_method
英文:
I'm trying to send a basic APNS push notification to a specific APNS token using AWS SNS. All the examples I'm finding are how to store the token in SNS, subscribe to channels, and publish to channels.
I don't need that kind of usage with the application I'm building. The golang application decides which users a push needs to be sent to for which actions. Then it looks up the tokens for those users in the DB. All I need is a basic request to send a push notification to that token (preferably asynchronously).
Here is one of the examples I've looked at:
http://docs.aws.amazon.com/sdk-for-go/api/service/sns/SNS.html#Publish-instance_method
答案1
得分: 2
要使用Publish操作将消息发送到移动终端(如Kindle设备或手机上的应用程序),您需要指定EndpointArn。在使用CreatePlatformEndpoint操作进行调用时,将返回EndpointArn。
获取EndpointArn的最简单方法是将其与APNS令牌一起存储在数据库中,或者将其作为APNS令牌的替代品存储在数据库中,假设您正在使用CreatePlatformEndpoint操作。否则,请参考以下问题:https://stackoverflow.com/questions/22501373/amazon-sns-how-to-get-endpointarn-by-tokenregistrationid-using-amazon-net-sd
英文:
> To use the Publish action for sending a message to a mobile endpoint,
> such as an app on a Kindle device or mobile phone, you must specify
> the EndpointArn
. The EndpointArn
is returned when making a call with
> the CreatePlatformEndpoint
action.
The easiest way of getting the EndpointArn
would be to store it along with or instead of the APNS token in your DB, assuming you are using CreatePlatformEndpoint
. Otherwise have a look at this question: https://stackoverflow.com/questions/22501373/amazon-sns-how-to-get-endpointarn-by-tokenregistrationid-using-amazon-net-sd
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。
评论