Tag: sails.js firebase

通过Firebase生成推送通知

我试图从我的REST服务生成通知。 缺点是不发送,虽然fcm.googleapis.com/fcm/send反应是成功的。 这个我以两种方式做,首先由模块http: var http = require('http'); var options = { 'hostname': 'fcm.googleapis.com', 'path': '/fcm/send', 'method': 'POST', 'headers': { 'Authorization': 'key=<Key Server>', 'Content-Type': "application/json" } }; var data = { 'to':tokenPush, 'notification':notification }; var requestHttp = http.request(options, function(res){ res.setEncoding('utf8'); res.on('data', function (chunk) { console.log(chunk); }); }); requestHttp.on('error', function(e) { console.log('problem with request: ' + e.message); […]