【问题标题】:Not receiving Firebase Cloud Messaging delivery receipts未收到 Firebase 云消息传递收据
【发布时间】:2018-11-21 13:23:22
【问题描述】:

我正在通过 fcm xmpp 客户端发送以下消息。但我没有收到已发送邮件的收据。

我正在使用node-xcs节点包发送XMPP消息。

var Sender = require('node-xcs').Sender;
var Message = require('node-xcs').Message;
var Notification = require('node-xcs').Notification;
var Result = require('node-xcs').Result;
var xcs = new Sender('123', 'xxxx', 1);
const uuidv4 = require('uuid/v4');
xcs.on('message', function(messageId, from, data, category) {
    console.log('received message', arguments);
}); 


xcs.on('receipt', function(messageId, from,  data, category){
    console.log(messageId,'dsafdsafdsaf')
});

xcs.on('connected', function(){console.log('connected')});
xcs.on('disconnected', function(){console.log('disconnected')});
xcs.on('online', function(){console.log('online')});
xcs.on('error', console.error);
xcs.on('message-error', function(){console.log('message-error')});

var notification = new Notification("./logo.png")
    .title("Hello buddy!")
    .clickAction("https://github.com/guness/node-xcs/blob/master/google/Notification.js")
    .body("test_body")
    .build();

var message = new Message(uuidv4())
    .priority("high")
    .dryRun(false)
    .deliveryReceiptRequested(true)
    .notification(notification)
    .build();

xcs.sendNoRetry(message, 'token', function(result) {
    if (result.getError()) {
        console.error(result.getErrorDescription());
    } else {
        console.log("message sent: #" + result.getMessageId());
    }
});

下面是包发送的XMPP消息

<gcm xmlns="google:mobile:data">{
  "to": "token",
  "message_id": "59171fc6-42ad-4f22-812f-d0c4f7fa63d0",
  "priority": "high",
  "delivery_receipt_requested": true,
  "notification": {
    "body": "test_body",
    "click_action": "https://github.com/guness/node-xcs/blob/master/google/Notification.js",
    "icon": "./logo.png",
    "title": "Hello buddy!"
  }
}</gcm>

我收到ack,但是我没有收到回执,为什么即使消息已送达,回执也没有?

【问题讨论】:

  • 我正在做一些我通常会警告其他人不要做的事情 - 试图在不熟悉域基础知识的情况下解决问题 :) 您在哪里期待收货?在 GCF 标准输出的控制台上?
  • console.log(messageId,'dsafdsafdsaf'),我要邮件的送达回执,可以用来标记消息已送达。
  • node-xcs 适用于 node.js 版本

标签: node.js firebase xmpp firebase-cloud-messaging google-cloud-functions


【解决方案1】:

node-xcs 是基于node-gcm-ccs 的作品,没有得到妥善维护。
请参阅node-xcs最后的免责声明
您甚至无法向 ios 设备发送通知,因为它只是为了支持将 FCM 发送到 android 和 Web 设备而构建的。

here,它说它没有用非常粗体的字母维护。
我建议使用fcm-push 而不是使用node-xcs

去年我在使用这个库时遇到了类似的问题,在阅读了这些非常大胆的“未维护未维护”消息后,我切换到了 fcm-push。

【讨论】:

    猜你喜欢
    • 2020-10-19
    • 2020-07-16
    • 2020-06-16
    • 2019-02-06
    • 2020-07-28
    • 2017-05-05
    • 2017-12-24
    • 1970-01-01
    • 2019-10-08
    相关资源
    最近更新 更多