Merge branch 'master' into dev

This commit is contained in:
Nick O'Leary 2023-05-25 17:42:34 +01:00
commit 3a9f38a873
No known key found for this signature in database
GPG Key ID: 4F2157149161A6C9
1 changed files with 7 additions and 1 deletions

View File

@ -702,7 +702,8 @@ module.exports = function(RED) {
node.options.rejectUnauthorized = (node.verifyservercert == "true" || node.verifyservercert === true);
}
}
node.v5 = () => node.options && node.options.protocolVersion == 5
node.subscriptionIdentifiersAvailable = () => node.v5() && node.serverProperties && node.serverProperties.subscriptionIdentifiersAvailable
n.autoConnect = n.autoConnect === "false" || n.autoConnect === false ? false : true;
node.setOptions(n, true);
@ -925,7 +926,12 @@ module.exports = function(RED) {
};
node.subscriptions[topic][ref] = sub;
if (node.connected) {
const subIdsAvailable = node.subscriptionIdentifiersAvailable()
node._clientOn('message',sub.handler);
// if the broker doesn't support subscription identifiers (e.g. AWS core), then don't send them
if (options.properties && options.properties.subscriptionIdentifier && subIdsAvailable !== true) {
delete options.properties.subscriptionIdentifier
}
node.client.subscribe(topic, options);
}
};