Save point (#506)

This commit is contained in:
Arnaud Marchand 2018-11-28 19:39:52 +01:00 committed by Dave Conway-Jones
parent b75f12aced
commit d73d5f1af3
1 changed files with 5 additions and 5 deletions

View File

@ -66,15 +66,15 @@ module.exports = function(RED) {
node.client.connect(function(sessionId) {
node.log('subscribing to: '+node.topic);
node.client.subscribe(node.topic, function(body, headers) {
var newmsg={"headers":headers,"topic":node.topic}
try {
msg.payload = JSON.parse(body);
newmsg.payload = JSON.parse(body);
}
catch(e) {
msg.payload = body;
newmsg.payload = body;
}
msg.headers = headers;
msg.topic = node.topic;
node.send(msg);
node.send(newmsg);
});
}, function(error) {
node.status({fill:"grey",shape:"dot",text:"error"});