Skip to content

Commit

Permalink
Add a 2 minute session expiry on the mqtt connection
Browse files Browse the repository at this point in the history
  • Loading branch information
knolleary committed May 2, 2024
1 parent 2b70c7a commit 08e2581
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions nodes/project-link.js
Original file line number Diff line number Diff line change
Expand Up @@ -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: {
Expand Down

0 comments on commit 08e2581

Please sign in to comment.