1
0
mirror of https://github.com/node-red/node-red-nodes.git synced 2023-10-10 13:36:58 +02:00

Bugfix: backward compatible node.topic has prio + Docs: added info about msg.topic in ACK node docs

This commit is contained in:
Olivier Verhaegen 2023-06-07 14:49:21 +02:00 committed by GitHub
parent 04fee39a5a
commit 5fc7d873d9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 2 deletions

View File

@ -197,6 +197,7 @@
<p>
The node allows for following inputs:
<ul>
<li><code>msg.topic</code>The topic to which the message should be acknowledged, if the <b>Destionation</b> field is set the msg.topic will be overwritten by this value</li>
<li><code>msg.messageId</code>: The id of the message to acknowledge</li>
<li><code>msg.transaction</code>: Optional transaction name</li>
</ul>

View File

@ -420,7 +420,7 @@ module.exports = function(RED) {
setStatusDisconnected(node);
node.on("input", function(msg, send, done) {
const topic = msg.topic || node.topic;
const topic = node.topic || msg.topic;
if (topic.length > 0 && msg.payload) {
try {
msg.payload = JSON.stringify(msg.payload);
@ -469,7 +469,7 @@ module.exports = function(RED) {
setStatusDisconnected(node);
node.on("input", function(msg, send, done) {
const topic = msg.topic || node.topic;
const topic = node.topic || msg.topic;
if (topic.length > 0) {
node.serverConnection.ack(topic, msg.messageId, msg.transaction);
} else if (!topic.length > 0) {