From 08e25819ca3f4bd51a6fc9f67527b2fe717b918a Mon Sep 17 00:00:00 2001 From: Nick O'Leary Date: Thu, 2 May 2024 15:58:42 +0100 Subject: [PATCH] Add a 2 minute session expiry on the mqtt connection --- nodes/project-link.js | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/nodes/project-link.js b/nodes/project-link.js index 0436fd7..ab3fa2f 100644 --- a/nodes/project-link.js +++ b/nodes/project-link.js @@ -526,8 +526,13 @@ module.exports = function (RED) { /** @type {MQTT.IClientOptions} */ const defaultOptions = { protocolVersion: 5, + clean: false, reconnectPeriod: RED.settings.mqttReconnectTime || 5000, properties: { + // Allow the broker to keep the session alive for 2 minutes after + // a disconnect. This ensures short-connectivity blips do not lead to + // inbound message loss. + sessionExpiryInterval: 120, requestResponseInformation: true, requestProblemInformation: true, userProperties: {