MQTT Publisher Works, Subscriber Gets Nothing? Compare Every Character
- PLC Play Ground
- 0
- Posted on
A tiny topic-name difference can separate a working publisher from a silent subscriber. Compare the actual published topic with the subscription filter character by character.
Original topic examples; inspect actual broker permissions as well as matching.
What is happening?
MQTT topic matching is case-sensitive and uses slash-separated levels. Leading or trailing slashes and different capitalization can create different names. Broker authorization and subscription acknowledgment are additional checks after matching is confirmed.
Check these five things
-
Capture the exact topic used by the publisher.
-
Read the actual subscription filter.
-
Compare capitalization and every topic level.
-
Check subscription acknowledgment and broker permissions.
-
Use a narrowly scoped test topic in the approved environment.
Worked example
In a teaching example, plant/Line1/pressure and plant/line1/pressure are different topics. A subscriber listening to one does not receive a publication on the other simply because the names look similar. A written naming convention prevents this class of mismatch.
Quick diagnostic reference
| Difference | Effect |
|---|---|
| Line1 versus line1 | Different name |
| Leading slash | Additional empty level |
| Wrong level | Filter may not match |
The mistake to avoid
A broad wildcard subscription can help controlled diagnosis but should not become an accidental production data contract. Keep topic scope explicit.
How to verify the fix
Test exact matching and intended wildcard cases, then confirm access controls and payload handling for the approved topic tree.
Field-work boundary: These are educational diagnostic guides. Use the exact equipment manuals and approved site procedures. Electrical testing and machinery changes belong to qualified, authorized personnel; control hazardous energy and validate affected functions before release.
Technical reference
HiveMQ: MQTT publish and subscribe topics. The examples and diagnostic tables above are original teaching material; they do not replace the product manual.
