【发布时间】:2017-03-06 03:07:30
【问题描述】:
我是 strongloop 的新手,我为 android 实现了推送通知。
在一段时间内一切正常,然后设备开始从数据库中的安装集合中消失,同时发送通知。我不知道为什么会这样,请帮助我解决这个问题。
在哪些情况下会发生这种情况?
我用于发送通知的 pushService 代码:
exports.sendPush = function (appObject,deviceId,type,userId,incomingMessage) {
var PushModel = appObject.models.push;
var androidNotification = appObject.models.notification;
// to avoid event emitter memory leak
pushModel.removeAllListeners('error');
var note = new androidNotification({
message: incomingMessage,
deviceId: deviceId,
type: type
});
pushModel.notifyByQuery({userId: userId,deviceType:"android"}, note, function(err) {
if(err)
{
console.log('android : pushing notification failed to %j', userId);
}
else
{
console.log('android : pushing notification to %j', userId);
console.log('android note : ',note);
}
});
pushModel.on('error', function (err) {
console.error('Push Notification error: ', err.stack);
});
};
【问题讨论】:
-
我也有同样的问题。
-
@mnesarco 的任何解决方案?
-
很抱歉@ilir-aga 我不再使用 StrongLoop。
标签: javascript strongloop