Urgent.News

What's breaking now, across thousands of outlets.

Tech

Your MQTT devices keep publishing when the WAN drops — here's the setup

Devices publish MQTT to a broker in the cloud. It works, until the link to the site goes down for forty minutes. What happened to the readings in between is usually discovered weeks later, by someone looking at a gap in the historian while investigating something unrelated. There are two standard answers, and they're both reasonable. QoS 1 with a persistent session. The client retries…

When the WAN connection drops, devices continue publishing MQTT messages to a cloud broker. The issue isn't discovered until weeks later, when someone notices a gap in the historian data. Two solutions exist: QoS 1 with persistent sessions or a local broker bridged to the cloud. The latter option, despite not being technically challenging, involves maintaining a broker for each site, which can become overwhelming as the number of sites grows.

Buffering is a solved problem, but the real challenge lies in the namespace issue. Each site has its unique identity and naming scheme, leading to inconsistencies across the network. A better approach is to keep MQTT at the device level and place a local MQTT interface at the site, which persists messages locally and integrates with the hub.

This approach eliminates the namespace problem, as the MQTT topic levels map directly onto the NATS subject tokens. While this solution adds another process at each site, it simplifies namespace management and reduces integration complexity as the number of sites increases.

Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.

Read the original at dev.to →

More in Tech

More from Wednesday 23 September →