Katman MQTT Client
Loading account

MQTT Request Response: Replies and Timeouts

Pair MQTT requests with replies using topic variables or MQTT 5 correlation data. See how Katman tracks exchange latency, overlapping requests, and timeouts.

By Katman

You publish a command to a device. Something arrives on another topic a moment later. Was that the reply, was it from the right device, and how long did the exchange take?

Katman MQTT’s Request / Response workspace keeps those questions together. This guide explains topic-based rules, MQTT 5 correlation, and how to read the timing without confusing a broker acknowledgement with an application reply.

A message is only half the story

A live message list gives you the raw traffic, but following that conversation takes work. You find the outgoing message, hunt for a response, compare timestamps, and try to keep the two payloads in your head while more traffic arrives.

Katman MQTT’s Request / Response workspace brings those pieces together. You define which requests belong with which replies, and the monitor builds an exchange with a status, timestamps, and a latency measurement. Open an exchange to inspect the request and response payloads side by side, along with the matching method and status reason.

What you need

Connect Katman to a broker where you can observe both request and reply traffic. Your device or test service must implement the reply convention; Katman’s monitor does not create a responder. Configure a matching rule before sending requests.

Free includes one Request / Response rule across connections. MQTT 5 metadata-based monitoring requires Pro. Publishing MQTT 5 properties from a template is a separate operation; see plans and limits.

The examples below illustrate the topic and metadata configuration. They are not measurements from a released desktop binary. The behavior was checked against the current application source on 13 November 2026.

Start with the topics you already use

A rule describes a conversation on a broker connection: give it a name, choose the request topic and expected response topic, and set a timeout that makes sense for the operation.

For a single device, exact topics may be enough. Open Request / Response, add a named rule for the active connection, and enter the request topic, response topic, and timeout.

For a fleet, named topic variables let one rule follow the same exchange across devices. For example:

Rule: Device command replies
Request:  devices/{deviceId}/request
Response: devices/{deviceId}/response
Timeout:  5 seconds

When the monitor observes a request on devices/pump-07/request, it resolves the expected reply topic to devices/pump-07/response. A request from another device gets its own resolved topic. Variables occupy a complete topic level, and a response variable must come from the request pattern.

To try the topic rule without a device, use a dedicated test broker and a second MQTT client. With Katman subscribed to devices/pump-07/# and the rule saved, publish the following messages in order, less than five seconds apart:

Topic Example JSON payload
devices/pump-07/request {"command":"get_status"}
devices/pump-07/response {"status":"ready"}

Keep retain off. The expected result is a RECEIVED exchange with both payloads and a latency value. Send only the request on the next attempt and wait more than five seconds to see TIMEOUT. These are manual test inputs, not commands that a real pump necessarily understands.

Rules are scoped to broker connections, so identical topic names on separate connections stay separate. Use patterns that resolve to a concrete response topic; they make the expected pairing easier to inspect.

A useful distinction: topic variables identify a conversation’s topic path. If several requests share that same reply path without correlation data, a reply settles the oldest pending request. JSON payload fields such as requestId are not used for matching. Use unique MQTT 5 correlation data where possible to distinguish overlapping replies.

Let MQTT 5 carry the matching details

On an MQTT 5 connection, expand the rule’s advanced section and enable Use MQTT 5 Response Topic when present. This Pro option lets a rule prefer the request’s Response Topic and Correlation Data. The Response Topic tells the responder where to reply. Correlation Data gives it a value to return so the reply can be linked to the request.

That is especially useful when requests overlap. Instead of relying on a shared topic alone, the monitor can match the correlation value. When an expected topic exists, the reply must match that topic as well as the correlation data. A configured response topic can act as a fallback when the request does not provide one. The exchange detail shows which method was used, making the pairing easier to inspect.

For an illustrative exchange, publish a request to devices/pump-07/request with Response Topic devices/pump-07/replies and unique Correlation Data. Have the responder publish to devices/pump-07/replies and echo the same correlation bytes. The expected result is one RECEIVED exchange matched using MQTT 5 metadata. A different correlation value should leave that request waiting until its timeout.

Publish Templates can generate fresh correlation data for each send. A configured, opted-in monitoring rule is still required; metadata alone does not start monitoring.

The responder still needs to follow your application’s convention and return the appropriate correlation data. Monitoring makes the exchange visible; it does not add request and response behavior to the device.

See what happened, and how long it took

WAITING — The request is tracked and its reply is still outstanding.

RECEIVED — A matching response has arrived.

TIMEOUT — The configured waiting period passed without a matching reply.

A QoS 1 broker acknowledgement confirms the broker delivery step; it does not mean the device processed the command or sent an application reply.

Each matched exchange includes its latency. Rule statistics add context with request counts, successful replies, waiting exchanges, timeouts, success rate, and current, average, minimum, and maximum latency.

For locally published requests, timing starts at dispatch. For observed incoming requests, it starts at Katman’s receive timestamp. Success rate counts successful replies divided by tracked requests, including requests still waiting; latency summaries use successful replies only. Treat the result as the observed time between the request and reply, rather than a measurement of device processing alone: transport and the rest of the application path also contribute.

The history can be searched and sorted, and its visible columns can be adjusted. That makes it easier to move from “something feels slow” to a particular exchange whose payloads and timing you can examine.

Use a timeout as a starting point

A timeout tells you that the monitor did not observe a matching reply within the configured window. It does not, by itself, tell you whether the device failed or the command was never processed.

  • Check the expected response topic. Does it resolve to the topic your device actually uses?
  • Inspect the matching metadata. If you use MQTT 5 correlation, does the responder return the expected value?
  • Confirm visibility. Can your connection observe the relevant request and response traffic?
  • Review the timeout. A quick status query and a slow physical operation may need different waiting periods.
  • Compare other exchanges. Look at individual timings as well as the average to see whether the delay is isolated or recurring.

A reply that arrives after an exchange has timed out does not revive it, and the monitor does not automatically retry the command.

The history is bounded, so use these statistics as a view of the exchanges currently retained by the monitor, rather than a permanent service-level report.

Spend less time reconstructing the exchange

When you are debugging a command path, the useful unit is often the whole conversation: what you asked, what came back, and how long you waited.

Start with one request pattern, one expected reply path, and a realistic timeout. Once those exchanges are easy to follow, expand the rule to more devices or use MQTT 5 correlation for busier traffic. You still have the messages to inspect—now you have their relationship, too.

Download Katman MQTT and start with one request/reply rule. To reuse your command payload, follow the Publish Templates guide.