aws-sdk-go
我需要向使用lib传递设备令牌数组的多个设备发送 SNS 推送通知。
目前我正在使用以下步骤将推送消息发送到 SNS:
创建端点:
pl, err := svc.CreatePlatformEndpoint(&sns.CreatePlatformEndpointInput{
PlatformApplicationArn: aws.String(topic),
Token: aws.String(n.DeviceToken), // just one device token
})
将消息发送到端点:
params := &sns.PublishInput{
Message: aws.String(payload),
TargetArn: aws.String(*pl.EndpointArn),
MessageStructure: aws.String("json"),
}
我还没有看到一种仅使用一个请求将一条推送消息发送到多个设备的方法。可能吗?
像这个例子来说明:
pl, err := svc.CreatePlatformEndpoint(&sns.CreatePlatformEndpointInput{
PlatformApplicationArn: aws.String(topic),
Token: []aws.String{token01, token02, token03}, //array of device tokens
})