Firebase云消息传递Node.JS通知未收到

时间:2016-10-16 12:34:52

标签: node.js post firebase apple-push-notifications firebase-cloud-messaging

我使用FCM和POST协议编写了​​一个Node.JS服务器,我的客户端应用程序是用Swift代码编写的。

在终端中,它会打印成功代码

id=0:1476620858011270%00f7ba1cf9fd7ecd

但在我的客户端应用程序中,没有通知。所以我尝试使用Firebase控制台中的通知选项卡,它运行得非常好。

这是我服务器文件中的标题

var headers = {
  'Content-Type': 'application/json',
  'Authorization': 'key=<Server Key>',
  'project_id': '<Project ID>'
}

这是我的请求代码

    request({
  headers: headers,
  url: "https://fcm.googleapis.com/fcm/send",
  method: "POST",
  form: {
    "notification" :{
      "title": "titie",
      "body": "body"
    },

    "content-available": true,
    "priority": "high",
    "to": "<Firebase Token>"
  }
  }, function(error, response, body) {
    console.log(body);
  });

0 个答案:

没有答案