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

better handling of server properties

This commit is contained in:
Steve-Mcl 2020-12-07 12:25:51 +00:00
parent 6150ae787d
commit 6bac207611

View File

@ -379,24 +379,23 @@ module.exports = function(RED) {
node.connected = true;
node.log(RED._("mqtt.state.connected",{broker:(node.clientid?node.clientid+"@":"")+node.brokerurl}));
if(node.options.protocolVersion == 5 && connack && connack.hasOwnProperty("properties")) {
let mqttServerV5Properties = arguments[0].properties;
if(mqttServerV5Properties) {
//node.serverProperties = mqttServerV5Properties; //assign all props, below, square them up.
setIntProp(mqttServerV5Properties, node.serverProperties, "topicAliasMaximum", 1);
setIntProp(mqttServerV5Properties, node.serverProperties, "receiveMaximum", 0);
setIntProp(mqttServerV5Properties, node.serverProperties, "sessionExpiryInterval", 0, 0xFFFFFFFF);
setIntProp(mqttServerV5Properties, node.serverProperties, "maximumQoS", 0, 2);
setBoolProp(mqttServerV5Properties, node.serverProperties, "retainAvailable");
setBoolProp(mqttServerV5Properties, node.serverProperties, "wildcardSubscriptionAvailable");
setBoolProp(mqttServerV5Properties, node.serverProperties, "subscriptionIdentifiersAvailable");
setBoolProp(mqttServerV5Properties, node.serverProperties, "sharedSubscriptionAvailable");
setIntProp(mqttServerV5Properties, node.serverProperties, "maximumPacketSize", 0);
setIntProp(mqttServerV5Properties, node.serverProperties, "serverKeepAlive");
setStrProp(mqttServerV5Properties, node.serverProperties, "responseInformation");
setStrProp(mqttServerV5Properties, node.serverProperties, "serverReference");
setStrProp(mqttServerV5Properties, node.serverProperties, "assignedClientIdentifier");
setStrProp(mqttServerV5Properties, node.serverProperties, "reasonString");
setUserProperties(mqttServerV5Properties, node.serverProperties);
if(typeof connack.properties == "object") {
//clean & assign all props sent from server.
setIntProp(connack.properties, node.serverProperties, "topicAliasMaximum", 1);
setIntProp(connack.properties, node.serverProperties, "receiveMaximum", 0);
setIntProp(connack.properties, node.serverProperties, "sessionExpiryInterval", 0, 0xFFFFFFFF);
setIntProp(connack.properties, node.serverProperties, "maximumQoS", 0, 2);
setBoolProp(connack.properties, node.serverProperties, "retainAvailable");
setBoolProp(connack.properties, node.serverProperties, "wildcardSubscriptionAvailable");
setBoolProp(connack.properties, node.serverProperties, "subscriptionIdentifiersAvailable");
setBoolProp(connack.properties, node.serverProperties, "sharedSubscriptionAvailable");
setIntProp(connack.properties, node.serverProperties, "maximumPacketSize", 0);
setIntProp(connack.properties, node.serverProperties, "serverKeepAlive");
setStrProp(connack.properties, node.serverProperties, "responseInformation");
setStrProp(connack.properties, node.serverProperties, "serverReference");
setStrProp(connack.properties, node.serverProperties, "assignedClientIdentifier");
setStrProp(connack.properties, node.serverProperties, "reasonString");
setUserProperties(connack.properties, node.serverProperties);
debug("MQTTBrokerNode: ⬆ CONNECTED. node.serverProperties ==> ", node.serverProperties );
}
}