mirror of
https://github.com/node-red/node-red.git
synced 2023-10-10 13:36:53 +02:00
mqtt v5 fixes
- copy/paste issues with willMsg - ensure helper func is ran for lwt messages
This commit is contained in:
parent
0dc4440a99
commit
080e2f2589
@ -188,7 +188,7 @@ module.exports = function(RED) {
|
||||
setStrProp(n.birthMsg, this.birthMessage, "contentType");
|
||||
if(n.birthMsg.userProps && /^ *{/.test(n.birthMsg.userProps)) {
|
||||
try {
|
||||
this.birthMessage.userProperties = JSON.parse(n.birthMsg.userProps)
|
||||
setUserProperties(JSON.parse(n.birthMsg.userProps), this.birthMessage);
|
||||
} catch(err) {}
|
||||
}
|
||||
n.birthMsg.responseTopic = n.birthMsg.respTopic;
|
||||
@ -196,7 +196,7 @@ module.exports = function(RED) {
|
||||
n.birthMsg.correlationData = n.birthMsg.correl;
|
||||
setBufferProp(n.birthMsg, this.birthMessage, "correlationData");
|
||||
n.birthMsg.messageExpiryInterval = n.birthMsg.expiry
|
||||
setIntProp(n.willMsg,this.birthMessage, "messageExpiryInterval")
|
||||
setIntProp(n.birthMsg,this.birthMessage, "messageExpiryInterval")
|
||||
}
|
||||
}
|
||||
|
||||
@ -212,7 +212,7 @@ module.exports = function(RED) {
|
||||
setStrProp(n.closeMsg, this.closeMessage, "contentType");
|
||||
if(n.closeMsg.userProps && /^ *{/.test(n.closeMsg.userProps)) {
|
||||
try {
|
||||
this.closeMessage.userProperties = JSON.parse(n.closeMsg.userProps)
|
||||
setUserProperties(JSON.parse(n.closeMsg.userProps), this.closeMessage);
|
||||
} catch(err) {}
|
||||
}
|
||||
n.closeMsg.responseTopic = n.closeMsg.respTopic;
|
||||
@ -220,7 +220,7 @@ module.exports = function(RED) {
|
||||
n.closeMsg.correlationData = n.closeMsg.correl;
|
||||
setBufferProp(n.closeMsg, this.closeMessage, "correlationData");
|
||||
n.closeMsg.messageExpiryInterval = n.closeMsg.expiry
|
||||
setIntProp(n.willMsg,this.closeMessage, "messageExpiryInterval")
|
||||
setIntProp(n.birthMsg,this.closeMessage, "messageExpiryInterval")
|
||||
}
|
||||
}
|
||||
|
||||
@ -365,7 +365,7 @@ module.exports = function(RED) {
|
||||
setStrProp(n.willMsg, this.options.will.properties, "contentType");
|
||||
if(n.willMsg.userProps && /^ *{/.test(n.willMsg.userProps)) {
|
||||
try {
|
||||
this.options.will.properties.userProperties = JSON.parse(n.willMsg.userProps)
|
||||
setUserProperties(JSON.parse(n.willMsg.userProps), this.options.will.properties);
|
||||
} catch(err) {}
|
||||
}
|
||||
n.willMsg.responseTopic = n.willMsg.respTopic;
|
||||
@ -612,9 +612,6 @@ module.exports = function(RED) {
|
||||
setBufferProp(msg, options.properties, "correlationData");
|
||||
setStrProp(msg, options.properties, "contentType");
|
||||
setIntProp(msg, options.properties, "messageExpiryInterval", 0);
|
||||
if (msg.userProperties) {
|
||||
options.properties.userProperties = msg.userProperties;
|
||||
}
|
||||
setUserProperties(msg.userProperties, options.properties);
|
||||
setIntProp(msg, options.properties, "topicAlias", 1, node.serverProperties.topicAliasMaximum || 0);
|
||||
setBoolProp(msg, options.properties, "payloadFormatIndicator");
|
||||
@ -774,7 +771,8 @@ module.exports = function(RED) {
|
||||
this.messageExpiryInterval = n.expiry; //https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901112
|
||||
try {
|
||||
if (/^ *{/.test(n.userProps)) {
|
||||
this.userProperties = JSON.parse(n.userProps);//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
//setup this.userProperties
|
||||
setUserProperties(JSON.parse(n.userProps), this);//https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901116
|
||||
}
|
||||
} catch(err) {}
|
||||
// this.topicAlias = n.topicAlias; //https://docs.oasis-open.org/mqtt/mqtt/v5.0/os/mqtt-v5.0-os.html#_Toc3901113
|
||||
|
Loading…
Reference in New Issue
Block a user