MQTT Local Bridge Duplicates Messages
DodaTech
Updated 2026-06-26
1 min read
In this tutorial, you'll learn about MQTT Local Bridge Duplicates Messages. We cover key concepts, practical examples, and best practices.
The Problem
MQTT bridge between two local brokers duplicates or loops messages.
Quick Fix
Wrong
# Broker A
connection bridge-b
address 192.168.1.102:1883
topic # both
# Broker B
connection bridge-a
address 192.168.1.101:1883
topic # both```
Message published on A → B → A → B ... infinite loop.
### Right
Broker A (hub) — accepts all
listener 1883 allow_anonymous true
Broker B (spoke) — outbound only
connection hub address 192.168.1.101:1883 topic sensor/# out 2 // Local sensors → hub topic command/# in 2 // Commands ← hub try_private false cleansession false notifications false
Broker B publishes sensor/temp → Hub receives. Hub publishes command/reboot → B receives. No loops.
## Prevention
Local bridges can create message loops when both directions use #. Use hub-and-spoke topology: one central broker with leaf brokers bridging OUT only. Never create circles (A→B→A). Use directed topic filters with out/in instead of both. Set notifications false to prevent bridge status messages from looping.
DodaTech engineers apply these same patterns across Doda Browser, DodaZIP, and Durga Antivirus Pro for production IoT reliability.
## FAQ
<details style="margin-bottom:12px;border:1px solid #e2e8f0;border-radius:10px;overflow:hidden"><summary style="cursor:pointer;padding:14px 18px;font-weight:600;font-size:1.05rem;background:#f8fafc;border-bottom:1px solid #e2e8f0;color:#1e293b">### Best multi-broker topology?</summary><div style="padding:14px 18px;color:#475569;line-height:1.7;background:#fff"><p>Hub-and-spoke: one central broker, leaves bridge to hub only. Never bridge leaf-to-leaf. Prevents loops.</p>
<h3 id="how-to-detect-loops">How to detect loops?</h3><p>Check broker logs for repeated packet IDs. Monitor notification topics for patterns. Use topic prefixes (site1/sensor vs site2/sensor).</p>
<h3 id="what-does-try_private-do">What does try_private do?</h3><p>try_private true uses broker internal client ID. false uses connection_name as client ID. Use false to avoid conflicts.</p>
</div></details>
← Previous
MQTT Certificate Authentication Fails — Complete Guide
Next →
MQTT Bridge to Remote Broker Disconnects
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro