# What is MQTT, and why do some receipt printers use it?

> MQTT explained for developers: topics, QoS, retained messages, keep-alive and last will, and how Star CloudPRNT uses it to tell a printer a job is waiting.

- Published: 2026-10-26
- Tags: mqtt, push, cloudprnt, printers, architecture
- Author: Tillcast
- Canonical URL: https://tillcast.com/blog/what-is-mqtt-for-printers/
- Blog: https://tillcast.com/blog/

MQTT is a small publish/subscribe protocol: a device keeps one connection open to a broker and receives a short message the moment someone publishes to a topic it subscribed to. A receipt printer can use that to be told "a job is waiting" at once instead of asking a server every few seconds, at the cost of a standing connection and a broker to run. As of October 2026 printers connected to Tillcast poll, and pushing to printers over MQTT is planned, with no date.

## Publish, subscribe and a broker

In MQTT no client talks to another client. Every client connects to a **broker**, a server that routes messages. A client publishes a message to a **topic**, a name made of levels separated by slashes, such as `printers/kitchen/jobs`, and every client that subscribed to a matching **topic filter** receives it. In a filter, `+` stands for one level and `#` for everything below. MQTT was created in 1999 by engineers at IBM and Arcom, versions 3.1.1 (2014) and 5.0 (2019) are OASIS standards, and 3.1.1 is also an ISO standard. The registered ports are 1883 for plain TCP and 8883 for TLS.

We ran Eclipse Mosquitto 2.1.2 locally on 2026-10-21 and captured the output below. One client subscribed to `printers/+/jobs`; three messages were published, to `printers/kitchen/jobs`, `printers/bar/jobs/extra` and `printers/bar/jobs`:

```text
printers/kitchen/jobs q1 retain=0 {"title":"request-post"}
printers/bar/jobs q0 retain=0 {"title":"request-post"}
```

The middle message never arrived: `+` covers one level, and that topic has one more.

## What a message promises: QoS

Every message has a quality-of-service level. **QoS 0** is at most once: no acknowledgement, and the message can be lost. **QoS 1** is at least once: the sender keeps the message until it is acknowledged and, if the connection drops first, sends it again when it reconnects with the same session, so duplicates are possible. **QoS 2** is exactly once, at the cost of a four-packet handshake. These are the packets the client logged for each level (trimmed):

```text
QoS 0   PUBLISH
QoS 1   PUBLISH, PUBACK
QoS 2   PUBLISH, PUBREC, PUBREL, PUBCOMP
```

A subscriber gets the lower of the level the message was published at and the level it subscribed with. Brokers need not offer all three: AWS IoT Core supports QoS 0 and 1 only (as of October 2026).

## Staying connected: keep-alive, last will, retained messages, sessions

**Keep-alive.** A client names an interval when it connects. When it has nothing else to send, it sends a ping, `C0 00`, and the broker answers `D0 00`. If the broker hears nothing for one and a half intervals, it treats the client as gone. We connected a bare socket with an interval of 2 seconds, pinged once and went silent:

```text
t=0.0s -> PINGREQ   c0 00
t=0.0s <- PINGRESP  d0 00
t=0.1s -- silent: no more packets
t=3.3s broker closed the connection after 3.2 s of silence
```

**Last will.** At connect, a client can leave a message with the broker: publish this on my behalf if I vanish without saying goodbye. Ours was marked retained. The broker published it as the silent client dropped:

```text
already subscribed   status/printer-raw retain=0 offline
subscribed later     status/printer-raw retain=1 offline
```

The flag differs because the broker keeps the latest **retained** message of a topic and hands it to each new subscriber with the flag set, while a message for an existing subscription goes out with it cleared. A client that sends a proper DISCONNECT first, `E0 00`, leaves no will behind; we checked that too. Retained messages suit state such as "online". They do not suit jobs, because a retained "job waiting" would be replayed to every printer that reconnects.

**Sessions.** With clean session off, the broker remembers a client's subscriptions and queues QoS 1 messages while it is away. We sent two QoS 1 messages and one QoS 0 message to a client that had gone away. When it returned with the same client ID, it received the two:

```text
jobs/printer-A q1 job-1 waiting (QoS 1)
jobs/printer-A q1 job-2 waiting (QoS 1)
```

A client with a clean session received nothing. Mosquitto drops QoS 0 for absent clients by default, and AWS IoT Core keeps queued messages for an hour unless that is changed. The broker's queue is a second place where a job can wait, so keep your own job queue as the truth.

## TLS and credentials

MQTT does not encrypt anything itself; the specification leaves security to the implementation and points to TLS, with a user name and password in the connect packet or a client certificate. Against a Mosquitto with a TLS listener and a password file (throwaway values), the client printed this (trimmed), with the broker's log in brackets:

```text
no credentials                 Connection Refused: not authorised
wrong password                 Connection Refused: not authorised
right password, CA not given   Error: Protocol error   (broker log: tlsv1 alert unknown ca)
right password, CA given       no error   (broker log: negotiated TLSv1.3)
```

## Why it fits "a job is waiting"

A polling printer asks every few seconds and mostly hears "nothing". A job created at a random moment waits on average half the interval. With push, the notice arrives at once instead of at the next poll, and with Star's default settings a quiet printer sends only a ping per keep-alive interval. Star's CloudPRNT guide recommends its MQTT version to shorten the wait and to reduce the load of periodic polls, and its FAQ adds that in Full MQTT a kept-open session avoids repeating the TLS handshake, until a reconnect.

**Chart: Idle messages per printer per day**

A bar chart of idle messages per printer per day. An HTTP poll every 5 seconds makes 17,280, every 30 seconds 2,880, and an MQTT ping every 60 seconds 1,440.

| Label | Value (messages per day) |
| --- | ---: |
| HTTP poll, 5 s | 17,280 |
| HTTP poll, 30 s | 2,880 |
| MQTT ping, 60 s | 1,440 |

Source: Computed: 86,400 seconds in a day divided by the interval. The poll intervals of 5 and 30 seconds are examples. 60 seconds is the default keep-alive in Star's CloudPRNT settings (allowed range 30 to 1,200 seconds). A ping is needed only when the client has sent nothing else within the interval, and a poll is a full HTTP request with headers, so the counts understate the difference.

AWS also lists lower overhead and power use for MQTT than for HTTPS, which matters for sensors.

## Where it does not fit

- **It needs a broker and a standing connection.** That is one more service to run, size and watch.
- **Connections break.** AWS says an MQTT connection can last weeks or only minutes, and devices must detect a drop and reconnect. AWS recommends that clients wait a randomised, growing time between reconnection attempts (backoff with jitter).
- **Firewalls.** The printer connects out, so the venue needs no open port, but its network must allow outbound TCP to the broker's port. AWS IoT Core also accepts MQTT on port 443 with ALPN, and Star's settings include an ALPN field.
- **Brokers differ from the specification.** In the standard, `sport/#` also matches `sport`; AWS IoT Core says it does not. Mosquitto sends a stored retained message to a new subscriber whose filter has a wildcard; AWS IoT Core does not, and sends it only when the filter matches the topic exactly. AWS limits the payload of a publish request to 128.0 KB, while Star says a printer accepts 512.0 KB.
- **Duplicates happen.** At QoS 1 a job message can arrive twice. Star's printers remember the last 10 job tokens and refuse a repeat.

## How Star CloudPRNT uses MQTT

Star's CloudPRNT has an HTTP version that every CloudPRNT printer speaks and an MQTT version for newer models and firmware, which Star's [supported printers list](https://www.star-m.jp/starcloudPRNT-introduction.html) names (guide version 2.6.0, September 2026). At start-up the printer asks the server for its settings over HTTP. The answer can name a broker, and a printer that is told to use MQTT connects to it with MQTT 3.1.1 and can use a user name and password; client certificates are not supported. The keep-alive defaults to 60 seconds and TLS to on. While it cannot reach the broker it works over HTTP and asks the server for its settings again after 30 seconds, then at intervals growing to 1, 2, 4 and at most 8 minutes.

By default the printer subscribes to `star/cloudprnt/to-device/<mac>/#`, and the server publishes there. Two stand-in clients, not a real printer, with a made-up address. The first line comes from Trigger POST and the other two from Pass URL (the methods are described below), and `...` marks a shortened message:

```text
printer  got  star/cloudprnt/to-device/00:11:62:00:00:01/request-post  {"title":"request-post"}

printer  got  star/cloudprnt/to-device/00:11:62:00:00:01/print-job  {"title":"print-job","jobToken":"abc123","jobType":"url", ...}
server   got  star/cloudprnt/to-server/00:11:62:00:00:01/print-result  {"title":"print-result","jobToken":"abc123","printSucceeded":true, ...}
```

Star documents two methods. In **Trigger POST** the message only says to poll now, and the printer then makes its usual HTTPS requests: ask, download, confirm; the printer publishes no MQTT messages itself. In **Full MQTT / Pass URL** the message is the print job. It carries either the job itself (Full MQTT, so no download follows) or a URL to download (Pass URL), and the printer returns the result over MQTT. The messages a printer publishes use QoS 1, and Star recommends QoS 1 for the server's messages too. Star recommends Full MQTT / Pass URL for a quicker start of printing. The diagram shows Trigger POST.

**Diagram: Star's Trigger POST method: the open connection carries only a short message, and the job travels in a separate HTTPS exchange.**

A printer keeps one connection to a broker open. When a job is queued, the server publishes a short message, the broker passes it on at once, and the printer fetches the job from the server over HTTPS, prints it and reports the result.

1. The printer asks the server for its settings, which name the broker, then connects to the broker and subscribes to its own topic. The connection stays open.
2. Your software creates a job with one API call, and the server queues it.
3. The server publishes a short message to the printer's topic: a job is waiting.
4. The broker passes the message to the printer at once, over the connection that is already open.
5. The printer fetches the job from the server in a separate short HTTPS exchange and prints it.
6. The printer reports the result with a confirmation request and keeps waiting for the next message.

Epson's cloud method, Server Direct Print, polls, as the [Epson setup](https://docs.tillcast.com/printers/epson-setup) page of our docs describes it.

## Tillcast and MQTT today

Today printers poll. A Star printer asks its [printer URL](https://docs.tillcast.com/concepts/printer-url) for work over CloudPRNT's HTTP version, and an Epson printer does the same with Server Direct Print; the [jobs](https://docs.tillcast.com/concepts/jobs) page and [supported printers](https://docs.tillcast.com/printers/supported-printers) say what runs. Push to printers over MQTT is planned, with no date and no promises. Nothing about it can be set up today, and the [roadmap](https://docs.tillcast.com/roadmap) shows where it stands.

We are also planning Tillcast Bridge, a small device for network printers that cannot fetch jobs from a server by themselves. It connects out to Tillcast and passes each job to a receipt printer on the same local network (LAN or Wi-Fi), so nothing has to be opened to the internet. Printers on USB, a serial port or Bluetooth only are not supported. Tillcast Bridge will be sold as a device; it is not available yet, and it has no date and no price.

## Sources

Read in October 2026.

- OASIS, [MQTT Version 3.1.1](https://docs.oasis-open.org/mqtt/mqtt/v3.1.1/os/mqtt-v3.1.1-os.html) and [MQTT Version 5.0](https://docs.oasis-open.org/mqtt/mqtt/v5.0/mqtt-v5.0.html); [mqtt.org FAQ](https://mqtt.org/faq/).
- Eclipse Mosquitto, [mosquitto.conf manual](https://mosquitto.org/man/mosquitto-conf-5.html).
- AWS IoT Core, [MQTT](https://docs.aws.amazon.com/iot/latest/developerguide/mqtt.html), [protocols](https://docs.aws.amazon.com/iot/latest/developerguide/protocols.html) and [quotas](https://docs.aws.amazon.com/general/latest/gr/iot-core.html); [Device Advisor MQTT tests](https://docs.aws.amazon.com/iot/latest/developerguide/device-advisor-tests-mqtt.html); [Exponential backoff and jitter](https://aws.amazon.com/blogs/architecture/exponential-backoff-and-jitter/).
- HiveMQ, [MQTT Essentials: retained messages](https://www.hivemq.com/blog/mqtt-essentials-part-8-retained-messages/) and [keep alive](https://www.hivemq.com/blog/mqtt-essentials-part-10-alive-client-take-over/).
- Star Micronics, [supported printers](https://www.star-m.jp/starcloudPRNT-introduction.html) and CloudPRNT Protocol Guide: [overview](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-guide.html), [MQTT general specification](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/mqtt-method-reference/mqtt-common/index.html), [topics](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/mqtt-method-reference/mqtt-topic/index.html), [payloads](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/mqtt-method-reference/mqtt-payload/index.html), [settings request](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/http-method-reference/server-info-get/get-request.html) and [settings response](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/http-method-reference/server-info-get/get-response.html), [data size](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/protocol-reference/common-spec-reference/printjob-datasize/index.html) and [FAQ](https://star-m.jp/products/s_print/sdk/StarCloudPRNT/manual/en/faq.html).
- Tillcast docs, [Epson setup](https://docs.tillcast.com/printers/epson-setup), [supported printers](https://docs.tillcast.com/printers/supported-printers) and [roadmap](https://docs.tillcast.com/roadmap).

---

Tillcast is a print API for receipt printers: your software sends a job and a printer in the venue prints it. https://tillcast.com/
