小编And*_* DS的帖子

AWS SNS:为什么我的“幽灵”订阅没有显示在主题中

我在使用 Amazon AWS SNS 时遇到了一个奇怪的问题:使用aws-php-sdk(3.112.7)创建订阅和主题时,总是有“幽灵”或“隐形”订阅。

AWS 控制台屏幕截图

如您所见,此订阅存在于“订阅”选项卡中。但是,当我单击主题链接(此处cav_56826)时,我看不到任何订阅

AWS 主题屏幕截图

你们已经有类似的问题了吗?这怎么会发生?

这是我的简化代码:

  try
    {
        $arn = "arn:aws:sns:eu-west-1:XXXXXXXXXXXXXXXXX:app/APNS_VOIP_SANDBOX/ios_cav";
        $topics = array("allUsers", "cav_56826");
        $topicsToSubcribe = array();

        foreach ($topics as $topic)
        {
            $res = $this->snsClient->createTopic(['Name' => $topic]);
            if ($res->get('@metadata')['statusCode'] == 200)
            {
                array_push($topicsToSubcribe, $res->get('TopicArn'));
            }
            else
            {
                throw new Exception("An error occured during Amazon SNS createTopic", $res->get('@metadata')['statusCode']);
            }
        }

        $SNSEndPointData = $this->snsClient->createPlatformEndpoint([
            'PlatformApplicationArn' => $arn,
            'Token'                  => $token
        ]);

        foreach ($topicsToSubcribe as $topic)
        {
            $this->snsClient->subscribe([
                'Protocol' => "application",
                'Endpoint' …
Run Code Online (Sandbox Code Playgroud)

push-notification amazon-web-services amazon-sns aws-php-sdk

5
推荐指数
1
解决办法
518
查看次数