Firebase客户端不接收消息

时间:2017-08-15 16:20:46

标签: javascript node.js firebase firebase-cloud-messaging

我有以下@IsEVMPresent = 1

Node.js script

运行此操作时,我会收到 var registrationToken = "Long Token"; var serviceAccount = require("./config/ServiceAccount.json"); var payload = { data: { score: "850", time: "2:45" } }; admin.initializeApp({ credential: admin.credential.cert(serviceAccount), databaseURL: fireBaseConfig.databaseURL }); admin.messaging().sendToDevice(registrationToken, payload) .then(function(response) { // See the MessagingDevicesResponse reference documentation for // the contents of response. console.log("Successfully sent message:", response); }) .catch(function(error) { console.log("Error sending message:", error); }); 响应:

success

然后我有我的客户:

   Successfully sent message: { results: [ { messageId: '0:1502813815410638%e609af1cf9fd7ecd' } ],
  canonicalRegistrationTokenCount: 0,
  failureCount: 0,
  successCount: 1,
  multicastId: 5249778920849394000 }

现在我首先(作为我的客户端)访问网站,然后我在控制台中获取令牌,然后在我的后端(Node.js)中使用该令牌并发送消息(当客户端所在的点击时,是仍然开放)但没有任何反应。

有谁能告诉我我做错了什么?

0 个答案:

没有答案