Changed msg structure

This commit is contained in:
2020-08-18 11:24:32 +02:00
parent 6789484d8a
commit 2e2d3b460d
+7 -4
View File
@@ -55,10 +55,13 @@ module.exports = function(RED) {
node.status({fill:"green",shape:"dot",text:"connected"});
node.clientdb.on('notification', function(msg) {
try {
//console.log("Notification received");
msg.payload = JSON.parse(msg.payload);
//node.log(JSON.stringify(msg));
node.send(msg);
var outmsg = {};
outmsg.payload = JSON.parse(msg.payload);
delete msg.payload;
outmsg.topic = msg.channel;
delete msg.channel;
outmsg.pg_data = msg;
node.send(outmsg);
} catch (error) {
node.error(error);
}