mirror of
https://github.com/node-red/node-red-nodes.git
synced 2023-10-10 13:36:58 +02:00
Bugfix: not responsive to msg.topic on input of STOMP out node
This commit is contained in:
parent
983cab970e
commit
55ba9c89ed
@ -420,15 +420,21 @@ module.exports = function(RED) {
|
||||
setStatusDisconnected(node);
|
||||
|
||||
node.on("input", function(msg, send, done) {
|
||||
if (node.topic && msg.payload) {
|
||||
const topic = msg.topic || node.topic;
|
||||
if (topic.length > 0 && msg.payload) {
|
||||
try {
|
||||
msg.payload = JSON.stringify(msg.payload);
|
||||
} catch {
|
||||
msg.payload = `${msg.payload}`;
|
||||
}
|
||||
node.serverConnection.publish(node.topic, msg.payload, msg.headers || {});
|
||||
done();
|
||||
} else if (!topic.length > 0) {
|
||||
node.warn('No valid publish topic');
|
||||
|
||||
} else {
|
||||
node.warn('Payload is undefined or null')
|
||||
}
|
||||
done();
|
||||
});
|
||||
|
||||
node.serverConnection.register(node);
|
||||
|
Loading…
x
Reference in New Issue
Block a user