## MQTT

The MQTT publisher sends published values to an MQTT broker, with each value sent to a topic matching its path in the workspace.

### Publisher Properties
- **Broker URI**: the address of the broker, see [supported network protocols](#supported-network-protocols).
- **Client ID**: the name Pointcaster identifies itself with to the broker.
- **Auto Reconnect**: reconnect automatically if the connection to the broker drops.
- **Serialization Format**: how values that aren't plain numbers or strings are encoded, either JSON or MessagePack.
- **Serialize As Structures**: send bounding boxes as named fields instead of compact arrays. This is easier to read (e.g. in MQTT Explorer) but less efficient.
- **Send Retained**: mark messages as retained, so the broker holds the last value of each topic for new subscribers.
- **Empty Message Handling**: whether empty values are ignored, published once, or always published.

#### Supported Network Protocols
The network protocol used by the MQTT publisher is selected through the prefix of the Broker URI.
The following network protocols can be selected (assuming they are supported by the broker):
- `mqtt://<host>:<port>`
    -  TCP, insecure, fine for must use cases
- `tcp://<host>:<port>`
    - same as above, alias for `mqtt://`
- `mqtts://<host>:<port>`
    - TCP using SSL/TLS
- `ssl://<host>:<port>`
    -  same as above, alias for `mqtts://`
- `ws://<host>:<port>`
    - Insecure websockets
- `wss://<host>:<port>`
    - Secure websockets
- `unix://<path>`
    - A UNIX-domain socket
    - *nix only
    - Broker must be located on the same physical hardware

---

::: buttonlink
[View publisher source](https://github.com/matth-av/pointcaster/blob/qt/src/publishers/mqtt/mqtt_client.cc)
:::
0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9