node.js苹果apn推送p12证书使用方式

luoyjx · 2016-12-26 16:36 · 301次阅读

// "apn": "^2.1.2",
var apn = require('apn');

var service = new apn.Connection(
  "passphrase":"secret",
  "pfx":"/path/to/cert.p12",
  "production":false
});

var apnVoipProvider = new apn.Provider(voipOptions);

apnNotification = new apn.Notification();
apnNotification.badge = 1;
apnNotification.sound = 'msg.mp3';
apnNotification.alert = 'hello';
apnNotification.payload = {
  title: notification.title, id: notificationID, path: notification.path,
};

apnVoipProvider.send(apnNotification, token);

收藏

暂无评论

登录后可以进行评论。没有账号?马上注册