Iphone没有收到APNS的推送通知,它显示成功

时间:2018-03-28 12:39:32

标签: ios node.js apple-push-notifications

我在节点中使用APNS集成了推送通知。响应即将成功,但Iphone没有收到推送通知。

以下是节点中的代码:

var iosOptions = {
    key  : 'pkey.pem',
     cert : 'cert.pem',
     debug    : true,
     port: 2195,
     enhanced: true,
     gateway  : 'gateway.sandbox.push.apple.com',
     errorCallback : function(num, err) {
         console.error(err);
     }
 };

function sendNotification(request){
  sendIos(request.query.device_id, request.query.message, request.query.room, request.query.identity);
}

function sendIos(device_id, message, room, identity) {
   console.log(device_id, room, message, identity);
     let connection = new apns.Connection(iosOptions);
     let notification = new apns.Notification();
     notification.badge = 3;
       notification.sound = "default",
     notification.device = new apns.Device(device_id);
     notification.alert = "Hello World!";
     notification.expiry = Math.floor(Date.now() / 1000) + 3600;
     notification.payload = {"description" : "A good news !"};
     connection.sendNotification(notification);
 }

在控制台中获得这样的响应: [Wed Mar 28 2018 18:07:45 GMT + 0530(India Standard Time)]发送:d0f36f59db02fecf3d3465c97335ad9067a2aca4992e429b7b9e1d97ac812017 [2018年3月28日星期三18:07:45 GMT + 0530(印度标准时间)]打开插座

我错过了什么吗?

0 个答案:

没有答案