mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
Merge pull request #3562 from Steve-Mcl/mqttv5-userprops
MQTT Node - save and restore v5 config user props
This commit is contained in:
commit
3a7a606f6a
@ -480,6 +480,7 @@
|
||||
willRetain: {value:false},
|
||||
willPayload: {value:""},
|
||||
willMsg: { value: {}},
|
||||
userProps: { value: ""},
|
||||
sessionExpiry: {value:0}
|
||||
},
|
||||
credentials: {
|
||||
@ -609,6 +610,7 @@
|
||||
default: !this.userProps ? 'none':'json',
|
||||
types: [typedInputNoneOpt, 'json']
|
||||
});
|
||||
$("#node-config-input-userProps").typedInput('value',this.userProps);
|
||||
if (typeof this.keepalive === 'undefined') {
|
||||
this.keepalive = 15;
|
||||
$("#node-config-input-keepalive").val(this.keepalive);
|
||||
@ -718,6 +720,14 @@
|
||||
}
|
||||
|
||||
if (v5) {
|
||||
this.userProps = "";
|
||||
const userPropsType = $("#node-config-input-userProps").typedInput("type");
|
||||
if(userPropsType == "json") {
|
||||
const userProps = $("#node-config-input-userProps").val();
|
||||
if (userProps && typeof userProps === "string") {
|
||||
this.userProps = userProps.trim();
|
||||
}
|
||||
}
|
||||
this.birthMsg = saveV5Message("birth");
|
||||
this.closeMsg = saveV5Message("close");
|
||||
this.willMsg = saveV5Message("will");
|
||||
|
@ -415,8 +415,12 @@ module.exports = function(RED) {
|
||||
setIfHasProperty(opts, node, "topicAliasMaximum", init);
|
||||
setIfHasProperty(opts, node, "maximumPacketSize", init);
|
||||
setIfHasProperty(opts, node, "receiveMaximum", init);
|
||||
setIfHasProperty(opts, node, "userProperties", init);//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
setIfHasProperty(opts, node, "userPropertiesType", init);
|
||||
//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
if (hasProperty(opts, "userProperties")) {
|
||||
node.userProperties = opts.userProperties;
|
||||
} else if (hasProperty(opts, "userProps")) {
|
||||
node.userProperties = opts.userProps;
|
||||
}
|
||||
|
||||
function createLWT(topic, payload, qos, retain, v5opts, v5SubPropName) {
|
||||
let message = undefined;
|
||||
|
Loading…
Reference in New Issue
Block a user