问题描述:模拟向ios用户发送100条推送消息,后续均正常。但是前10多条显示不正常。具体问题请看下图:
发送模块相关逻辑如下:
var apn = require('apn');
var notify = new apn.Notification();
notify.device = new apn.Device("343e0048d877589f1e8956e2901d7beab575323724c4d719555d942453ecf3a9");
notify.payload = {'messageFrom': 'Caroline'};
notify.sound = "default";
notify.expiry = Math.floor(Date.now() / 1000) + 3;
var apnConnection = new apn.Connection({
cert : "cert.pem",
key : "key.pem",
maxConnections : 100,
gateway : "gateway.sandbox.push.apple.com"
});
var count = 0;
setInterval(function () {
if (count === 100) process.kill(process.pid);
notify.badge = count++;
notify.alert = "你好 APNS" + count;
apnConnection.pushNotification(notify, notify.device);
}, 300);
apnConnection.on("connected", function (openSockets) {
console.log('@__@!connected is ', openSockets);
});
apnConnection.on("disconnected", function (openSockets) {
console.log('$__$!disconnected is ', openSockets);
});
apnConnection.on("completed", function () {
console.log('#__#! completed.');
});
主要两个问题点: 1、最快发送频率?(本人实验间隔300ms以下,客户端没有反应); 2、对于批量发送是否只能发送内容一样的;
如有相关经验的,希望不吝赐教:)