使用Windows Azure推送Safari推送通知

时间:2013-11-12 23:15:30

标签: azure safari azure-mobile-services safari-push-notifications

我正在尝试将Safari Push Notifications与Windows Azure一起用作后端。我能够将Website Push ID: web.com...证书上传到Azure Mobile Services,并且在apple push notification settings中没有任何错误消息就接受了。

要处理Web服务端点(webServiceURL/version/pushPackages/websitePushIDwebServiceURL/version/devices/deviceToken/registrations/websitePushID等),我在移动服务中创建了一个工作正常的API。

但我无法发送推送通知或收到错误消息。

我的测试代码如下:

function send(req, res) {
    var push = req.service.push;
    var devicesTable = req.service.tables.getTable('devices');
    devicesTable.read({
        success: function(devices) {
            devices.forEach(function(device) {

                console.log("send to deviceToken " + device.deviceToken);

                push.apns.send(device.deviceToken, {
                    alert: 'Toast: A new Mobile Services task.',
                    payload: {
                        inAppMessage: "Hey, a new item arrived: '"
                    }
                });

                push.apns.send(device.deviceToken, {
                        alert: {
                            "title": "Test 123 ",
                            "body": "Test 123 ",
                            "action": "View"
                        },
                        "url-args": ["boarding"]
                    },
                    {
                        error : function(err) {
                            console.log("send error " + err);
                        }
                    }
                );

            });
        }
    });

    res.send(200, "");
}

我的问题是formatting of the dictionary还是Azure移动服务出于某种原因不支持Safari推送通知?

据我所知,APNS与iOS,Mac和Safari推送通知相同。

更新:我使用SimplePush对其进行了测试,因此证书就像注册Safari一样好。我的有效载荷如下所示:

// Create the payload body
$body['aps'] = array(
    'alert' => array(
        'title' => 'test',
        'body' => $message
    ),
    'url-args'  => array('test'),
);

1 个答案:

答案 0 :(得分:0)

我认为您已根据Apple的指导正确注册了Safari客户端 - 您是否在非Azure实施中测试了客户端?看看Apple的实施指南,即使不考虑将Azure作为推送信息源,也似乎有很多移动部件。

相关问题