【发布时间】:2019-04-04 20:04:56
【问题描述】:
我尝试使用 Firebase Cloud Messaging 找到简单的客户端-服务器应用程序。
我使用 Nodejs 和 this package,但我不知道如何以及在哪里可以找到客户端令牌?
这里是示例代码:
var fcm = require('fcm-notification');
var FCM = new fcm('path/to/privatekey.json');
var token = 'token here';
var message = {
data: { //This is only optional, you can send any data
score: '850',
time: '2:45'
},
notification:{
title : 'Title of notification',
body : 'Body of notification'
},
token : token
};
FCM.send(message, function(err, response) {
if(err){
console.log('error found', err);
}else {
console.log('response here', response);
}
})
【问题讨论】:
标签: node.js firebase firebase-cloud-messaging