Skip to main content
Aurikle

Equipment and operations

How to choose MQTT or HTTP for equipment telemetry

Choose MQTT or HTTP for equipment telemetry after you name who publishes a reading, who subscribes, and who takes a disconnect. MQTT is publish and subscribe between a client and a server. HTTP is one request and one response. The reading still has to land in the same equipment record the team already keeps.

On this page

Matching serviceAssessment, prototypes, and integration

Name the equipment record the reading must reach

Each kind of reading has to name which asset, which field, who receives it, and who takes a disconnect or a failed request. With those four lines in place, you can tell whether the reading should publish and subscribe, or send one request for one response.

The reading has to meet the maintenance or rental record you already run, or the board and the work order will each keep their own copy. How to assess the current work and then connect it is an Assessment, prototypes, and integration question. The five rental records are in How to choose an equipment rental management system. Work orders are in How to do predictive maintenance for equipment. The asset identifier is in How to choose barcode or RFID for equipment tracking.

MQTT 5.0 is publish and subscribe

MQTT Version 5.0 is an OASIS Standard dated 7 March 2019. It replaces MQTT 3.1.1, dated 29 October 2014. The abstract calls MQTT a client-server publish/subscribe messaging transport that is light weight and open, and suited to machine-to-machine and Internet of Things settings where a small code footprint is required or network bandwidth is at a premium. The protocol runs over TCP/IP, or over other network protocols that provide ordered, lossless, bidirectional connections. The adoption note names MQTT 5.0 as the text you read, rather than 3.1.1.

The same standard defines three qualities of service. At most once, messages are delivered by the best efforts of the operating environment and loss can occur. The standard's example is ambient sensor data, where a lost reading is acceptable because the next one is published soon after. At least once, messages are assured to arrive and duplicates can occur. Exactly once, messages are assured to arrive exactly once. The standard's example is a billing system, where a duplicate or a lost message could apply an incorrect charge. The standard also says the transport is agnostic to the payload, and that interested parties are notified when an abnormal disconnection occurs. Leave the billing example in the standard. It is not your charging rule. The standard states no distance and no battery figure, so the trial record leaves both blank.

HTTP is one request and one response

RFC 9110 is HTTP Semantics, STD 97. The abstract calls HTTP a stateless application-level protocol for distributed, collaborative, hypertext information systems. The same section describes HTTP as a family of stateless request/response protocols: a request can be considered in isolation, and the server does not have to bind it to a predetermined sequence of steps. Asking whether one asset can be rented now is that shape: one request, one response.

The same document dates the companion specifications HTTP/1.1 (RFC 9112), HTTP/2 (RFC 9113), and HTTP/3 (RFC 9114) to June 2022. The extracted header does not print a publication line for RFC 9110 itself. Use the companion dates as the date of that set, and cite RFC 9110 only for the request and the response. The page states no latency and no throughput, so the trial record leaves both figures blank. Write down the date you used.

Many subscribers, or someone asking for one record

When one reading must reach more than one subscriber, and a single lost ambient reading can wait for the next, the step matches MQTT publish/subscribe and the standard's own at-most-once example. Write the topic, the broker, and who is told of an abnormal disconnection. The standard leaves the payload open, so you put the asset identifier and the unit into the payload, matching the same record in the software. Name the unit beside the identifier.

When a person or another system asks for one record, and the response answers only that request, such as whether an asset can be rented now, the step matches HTTP's request and response. Write the URL, the method, which field a success updates, and who retries a failure. The two can sit together: periodic readings on MQTT, a single lookup on HTTP. Sitting together is an arrangement you can choose. It is not a requirement. The adoption note says which one you picked, or which kind of reading uses which protocol.

Duplicates and disconnects need a named owner

If you choose at least once, the standard says a message can arrive twice. The software has to treat that reading as one write, using the asset identifier plus the reading time, or another key you have already named. Without that rule, a board shows the same reading twice. Put the key on the adoption note, on the same line as the field name.

With MQTT, the abnormal-disconnect notice has to land on a list that has an owner. A notice that sits only in the broker log still has nobody taking it. With HTTP, a failed request lands on that same list. When nobody reviews the list on a fixed cycle, keep both protocols off the live equipment until the list and the cycle are written down.

An occasional lookup does not need a broker

When nobody operates a broker, the topic is still unnamed, or the only consumer occasionally asks for one record, leave MQTT off for that lookup. Ask for the record with one HTTP request, and write who retries a failure. MQTT returns to the short list after someone owns the broker and the topic has a name.

Consider exactly once only when a loss or a duplicate would cause an error you have already written down. The standard's example is billing. An ambient reading without that consequence stays at most once, or at least once with the duplicate rule written in the software. The standard states no bandwidth saved and no battery saved, so the trial record leaves both figures unwritten.

When a disconnect must be announced, read the MQTT notice

When the device must hold a connection, a disconnect must be announced, and the only design you can write is the server asking each asset in turn, read the abnormal-disconnect notice in the MQTT standard before you decide on publish/subscribe. If you can write the polling URL, the interval, and the owner of a failure, HTTP can stay on the short list. The interval has to come from your own maintenance rule, with a date. The seconds stay blank until that dated rule supplies them. The trial record does not invent a number of seconds.

When the identifier is unset, the reading has no unit, and nobody hands a failure to a work order, keep both protocols off the equipment. Write those three, then connect. Until a trial transmission exists, check the telemetry by whether every reading carries an identifier, whether a disconnect or a failure has an owner, and whether a duplicate reading is stored once.

Related notes

Book a consultationAssessment, prototypes, and integration