Most properties of the connection can be set dynamically
When msg.action
== "connect", then msg.broker
can contain the following....
{
url: String,
broker: String,
port: Number,
clientid: String,
autoConnect: Boolean,
usetls: Boolean,
usews: Boolean,
verifyservercert: Boolean,
compatmode: Boolean, // true is same as protocolVersion=3
protocolVersion: 3|4|5, //v3 | v3.11 (default) | v5
keepalive: Number,
cleansession: Boolean,
sessionExpiry: Number,
topicAliasMaximum: Number,
maximumPacketSize: Number,
receiveMaximum: Number,
userProperties: String|Object,
birth: {
topic: String,
payload: Any,
qos: Number,
retain: Boolean,
contentType: String,
userProperties: value,
responseTopic: String,
correlationData: String|Buffer,
messageExpiryInterval: Number,
},
close: {
topic: String,
payload: Any,
qos: Number,
retain: Boolean,
contentType: String,
userProperties: value,
responseTopic: String,
correlationData: String|Buffer,
messageExpiryInterval: Number,
},
will: {
topic: String,
payload: Any,
qos: Number,
retain: Boolean,
contentType: String,
userProperties: value,
responseTopic: String,
correlationData: String|Buffer,
messageExpiryInterval: Number,
willDelayInterval: Number,
}
}
NOTES...
- tls config cannot currently be set dynamically (only turned on/off)
- any setting provided will override existing
- e.g. you can simply change the
protocolVersion
and all other settings will remain the same.
- In simple terms, dont include a setting if you dont want to change it.