React native push notification with node.js

时间:2019-03-06 11:41:36

标签: javascript node.js react-native push-notification native

I am trying to add push notifications in my React app with Node.js but in response it gives result as InvalidRegistration

app.post('/subscribe', (req, res) => {
  var senderToken = req.body.to;
  regTokens.push(senderToken);
  sender.send(message, { registrationTokens: regTokens }, function (err, response) {
    if (err) console.error("err",err);
    else console.log(response);
      res.send();
    }
  ); 
});

response : { multicast_id: 5402766225339800000, success: 0, failure: 1, canonical_ids: 0, results: [ { error: 'InvalidRegistration' } ] }

0 个答案:

没有答案