2016-04-13 230 views
0

我是新手,以推送通知,我已经做了我从谷歌上搜索,它工作正常取出的参考代码的一部分,但我的查询是:GCM推送通知的NodeJS

  1. 发送推送通知到组的人(使用数组)
  2. 并且在该数组中有至少一个错误的gcm-id的机会
  3. 如果存在错误的gcm-id,则会填充“未注册”或“MisplacingId”单独发送)
  4. 现在,gcm-id在一个数组中,然后push将发送给re主要的人还是会阻止在那里呢?

这里是我的代码:

var GCM = require('gcm').GCM; 
var apiKey = 'xyz'; 
var gcm = new GCM('apiKey'); 

var message = { 
    registration_id: ['x','y'], 
    collapse_key: 'Hello', 
    priority: 'high', 
    contentAvailable: true, 
    delayWhileIdle: true, 
    timeToLive: 3, 
}; 

gcm.send(message, function(err, messageId){ 
    if (err) { 
     console.log("Something has gone wrong!"); 
     console.log(err); 
    } else { 
     console.log("Sent with message ID: ", messageId); 
    } 
}); 

,并请告诉我有任何LIMT(gcmid的数)?一举推动?

回答

0

即使数组之间看起来无效,它也会向所有注册ID发送推送通知。当注册ID无效

{ 
    multicast_id: 8976424350191695000, 
    success: 1, 
    failure: 1, 
    canonical_ids: 1, 
    results: [ 
    { 
     registration_id: "value-of-correct-registration-id", 
     message_id: "0:1460568231005603%ade1213ff9fd7ecd" 
    }, 
    { 
     error: "InvalidRegistration" 
    } 
    ] 
} 

的成功和失败的次数 样本响应将显示发送推送通知的数量和失败。注册ID的数量没有限制。