Changed msg structure
This commit is contained in:
+7
-4
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user