Explainer
When one edge PC can host the MQTT broker for the rest
Short answer
Yes: MQTT is publish-subscribe over plain IP reachability, so one edge PC can host the broker for the whole cell and every device needs only a TCP path to that one address. The design work is per connection: protocol version, QoS, TLS, retained messages and the last will. Verify each client's path and the failure behavior, not the broker app.
On this page
Yes — one edge PC can be the MQTT broker for every device in the cell: ten devices, one broker address, nine client connections. MQTT is publish-subscribe, so each client opens a single TCP session to the broker and never talks to another client directly; the broker pushes every published message to each subscriber of that topic. The architecture question is therefore never whether the devices can see each other, only whether each of them can reach one address on one port. That moves the engineering out of the broker app and into the connections: the protocol level each client declares, the QoS you set per connection, TLS and credentials, the retained messages that restore state after a reconnect, and the last will that announces a lost publisher. This page gives the rules those connections must satisfy, one worked detection-time calculation, and the checks to run before you call the design done.
Why one broker address is enough #
A publisher sends its message to a topic on the broker; the broker forwards it to every client subscribed to that topic. Providers and consumers never learn each other's addresses or status, the broker authenticates each client and enforces which topics it may touch, and the broker tells subscribers when a publisher disappears — that is the last will — while a reconnecting subscriber gets a retained topic's last value without waiting for the next publish. The practical consequence: adding a tenth device is one more client connection with its own credentials and topic rules, and nothing about the other nine changes.
Where the broker lives is still a placement decision — inside the PLC, on a dedicated box, or as one task on the shared edge PC — and running an MQTT broker in the PLC or on a separate device works through that trade. This page takes the separate edge PC, because that host usually also owns the path to the plant or customer system.
What the broker host must provide #
Give it one stable address in the cell network — a static IP or a hostname every client resolves — and a listener port per service: 1883 for plaintext MQTT, 8883 for MQTT inside TLS. Decide the split deliberately: plaintext stays inside an isolated cell VLAN, and any session that leaves it toward the plant or the customer network runs on the TLS port. The host firewall admits the listener port from the cell subnet; there is no client-to-client firewall rule anywhere, because no client talks to another.
Software is not the constraint. Eclipse Mosquitto, the open-source broker, is written in C and runs on small ARM-class edge boards, and version 2.0 added a dynamic security plugin that holds per-client topic rules with a management interface for watching traffic and access rights. Ten telemetry clients are a light load for that class of broker, so when you specify the machine itself, a fanless industrial mini PC in the cell cabinet is enough host for this design. The risk lives in the network path, not the processor.
What every client connection must settle #
Each connection carries its own decisions, and you record them per device:
- Protocol level: a broker that accepts MQTT 5 and 3.1.1 serves a mixed fleet, because each connection declares its own level in the connect packet. Set it deliberately in every client and record which it uses.
- Identity: one unique client ID per device. How MQTT client IDs separate device and application roles shows what a shared ID breaks when two clients connect under it.
- Credentials and permissions: a password or client certificate per connection, plus topic-level publish and subscribe rules held in the broker's access list.
- Delivery guarantee: choose QoS per connection by what a lost message costs, not one value for the cell. What a client that was offline receives is decided by the session and the broker's queuing behavior; MQTT offline message delivery: a queued broker versus standard QoS compares those mechanisms.
- State topics: mark last-known-value topics retained, so a reconnecting subscriber gets the current value at once.
- Failure notice: a last-will topic and payload on every publisher, with the keep-alive interval sized for how fast the cell must notice — the worked example below does that arithmetic.
- Session persistence: a subscriber that must resume after a broker restart needs a persistent session the broker stores; why a subscriber stops receiving after a broker restart is the failure when that is missing.
For the TLS and access-list configuration itself on a Mosquitto broker with Node-RED clients, a secure Mosquitto lab broker with Node-RED walks the setup end to end.
New consumers connect as clients; bridges join brokers #
Connect every new consumer — including the customer's system, once it speaks MQTT — as a plain client of the cell broker: credentials, topic rules, done. Configure a bridge only when the other side runs a broker of its own and the two must exchange topics. A bridge is one broker-to-broker client link, mapped topic by topic, in each direction you allow. The decision rule: a system that can publish or subscribe at your broker is a client; another broker in the path is a bridge.
Detecting a lost publisher with a 60-second keep-alive #
Inputs: the cell is the reader's own case — ten devices, one hosting the broker, nine publishing across the plant wireless segment. The setting under test is each client's keep-alive interval, at an example commissioning value of 60 seconds. The rule comes from the MQTT specification: the broker must drop a client connection that sends no control packet for one and a half times the keep-alive interval, and a connection that closes without a clean DISCONNECT makes the broker publish that client's last-will message. MQTT 5 can postpone the will with a will-delay interval, so set that delay to zero when the notice should leave at the moment of the drop.
Arithmetic: 1.5 × 60 s = 90 s. The worst case begins when a station fails just after its last successful keep-alive exchange, so subscribers can wait the full 90 seconds from the station's last packet before the will tells them it is down.
Decision: with a 30-second flagging requirement from production, keep the keep-alive at or below 20 s, because 30 s ÷ 1.5 = 20 s, and prove the wireless segment holds idle client sessions at least that long. Any packet from the client resets the window, and the will delay is the only other value that moves the notice time. On radio, a shorter keep-alive means every dropout past the window fires the will; that is correct behavior, so filter repeat notices at the dashboard instead of lengthening the keep-alive to hide them.
Prove the design before you accept it #
Run the checks in this order and record the result per device:
- From each client position, open a TCP session to the broker address on its listener port, through the real radio path and not from the wired office side.
- Publish one known value on a test topic from the first client and confirm it arrives at a test subscriber.
- Add clients one at a time; from each new client, attempt one publish and one subscribe outside its permitted topics and confirm the broker refuses both.
- Drop the link on the test publisher and time the will against the detection window computed above.
- Reconnect the test subscriber and confirm the retained value arrives without a new publish.
- Restart the broker inside a maintenance window and confirm persistent-session subscribers come back already subscribed.
- Measure the load at production pace — concurrent connections, publish rate, payload size — because no connection-count rating ships with a broker app; the acceptance number is the one you measure on this host and this network.
Questions asked
Can the nine clients connect to the broker over Wi-Fi?
MQTT needs a TCP path, not copper, so a Wi-Fi segment works as long as every client can open a session to the broker address on its listener port. Test each client with a real publish through the radio path, not from the wired side. Expect the last will to fire whenever a dropout outlasts the keep-alive window; on wireless that is the design working, not a fault.
Does the broker host need to be a powerful PC?
No. Mosquitto-class brokers written in C run on small ARM-class edge boards, and ten clients exchanging telemetry are a light load for that class. The real limits are network reachability, radio stability, and disk growth if you retain or log messages. Size the host from what you measure at commissioning — connections, messages per second, payload bytes — and give it the same restart discipline as any other plant server.
Which QoS level should each connection use?
Decide per connection by what a lost or duplicated message costs. QoS 0 sends once with no acknowledgement; QoS 1 adds an acknowledgement and redelivery until the receiver confirms; QoS 2 runs a four-packet handshake so the message arrives exactly once, at twice the traffic of QoS 1. Use QoS 1 for most telemetry, take QoS 2 only where a duplicate would cause harm, and remember delivery to an offline client needs a persistent session or a queuing feature.
What changes if the customer runs its own MQTT broker?
Keep two brokers and bridge them. The cell broker stays the one address your devices connect to, and the bridge forwards only the topics you list, in each direction you allow. Connect the customer straight to the cell broker only when it has no broker of its own, and leave control-action topics off the bridge unless that side is meant to act on the line.
Do subscriptions survive a broker restart?
Only with persistence on both sides. The client must connect with a persistent session — the clean-session flag cleared in MQTT 3.1.1, or a session expiry interval set in MQTT 5 — and the broker must store session state across restarts. A subscriber that then reconnects resumes its subscriptions without reissuing them. Without that, every client sends its subscriptions again after reconnecting; the broker never restores them on its own.