标签: node-apn

MaxListenersExceededWarning - 环回

我收到以下错误:

 (node:18591) MaxListenersExceededWarning: Possible EventEmitter memory 
leak detected. 11 wakeup listeners added. Use emitter.setMaxListeners() to increase limit.
Run Code Online (Sandbox Code Playgroud)

在执行发送推送通知的脚本之后。我正在使用“node-gcm”和“apn”npm 模块分别发送android 和ios 推送通知。我用于发送通知的代码是:

安卓:

async.each(tokenBatches, function (batch) {
// Assuming you already set up the sender and message
   sender.send(message, {registrationIds: batch}, function (err, result) {
    // Push failed?
    if (err) {
    // Stops executing other batches
        console.log(err);
    }
    console.log(result);
    });
});
Run Code Online (Sandbox Code Playgroud)

在这里,设备令牌作为一批 1000 个令牌传递。

IOS:

provider.send(notification, iosTokens).then((response) => {
   console.log(response);
});
Run Code Online (Sandbox Code Playgroud)

在这里,所有令牌都在 iosTokens 数组中发送。这两个脚本并行运行。这段代码可能有什么问题?我看到一些解决方案要求设置最大侦听器,但我没有做对。有什么办法可以修复内存泄漏错误。任何帮助,将不胜感激!提前致谢。

memory-leaks node.js loopbackjs node-apn node-gcm

5
推荐指数
0
解决办法
1791
查看次数

iOS 使用 node-apn 给通知一个标题

有没有办法使用 node-apn 设置粗体通知标题(就像大多数应用程序一样)?我尝试了以下设置器:

notification.body = "Body";
notification.title = "Title";
notification.alert = "Alert";
Run Code Online (Sandbox Code Playgroud)

但只有警报包含在通知中,并且是常规文本,看起来有点奇怪。

push-notification apple-push-notifications ios node-apn

2
推荐指数
1
解决办法
326
查看次数