I am sending the following message through fcm xmpp client. But I am not getting delivery receipt for the delivered messages.
I am using node-xcs
node package for sending XMPP message.
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());
}
});
Below is the XMPP message sent from the package
<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>
I am getting ack
, but I am not getting Delivery receipt, Why is the delivery receipt not coming even if the message is delivered?
console.log(messageId,'dsafdsafdsaf')
, I want the delivery receipt of the message, which can i use for marking message is delivered. – Caribou