2025-05-28 12:39:02 +00:00
|
|
|
# Client Configuration
|
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
This configuration structure is either a `amqtt.contexts.ClientConfig` or a python dictionary with identical structure
|
|
|
|
when instantiating `amqtt.broker.MQTTClient` or as a yaml formatted file passed to the `amqtt_pub` script.
|
2025-05-28 12:39:02 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
If not specified, the `MQTTClient()` will be started with the default `ClientConfig()`, as represented in yaml format:
|
2025-05-28 12:39:02 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
```yaml
|
|
|
|
---
|
|
|
|
keep_alive: 10
|
|
|
|
ping_delay: 1
|
|
|
|
default_qos: 0
|
|
|
|
default_retain: false
|
|
|
|
auto_reconnect: true
|
|
|
|
connection_timeout: 60
|
|
|
|
reconnect_retries: 2
|
|
|
|
reconnect_max_interval: 10
|
|
|
|
cleansession: true
|
|
|
|
broker:
|
|
|
|
uri: "mqtt://127.0.0.1"
|
|
|
|
plugins:
|
|
|
|
amqtt.plugins.logging_amqtt.PacketLoggerPlugin:
|
|
|
|
```
|
2025-06-26 02:23:20 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
::: amqtt.contexts.ClientConfig
|
|
|
|
options:
|
|
|
|
heading_level: 3
|
|
|
|
extra:
|
|
|
|
class_style: "simple"
|
2025-06-03 04:05:20 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
::: amqtt.contexts.TopicConfig
|
|
|
|
options:
|
|
|
|
heading_level: 3
|
|
|
|
extra:
|
|
|
|
class_style: "simple"
|
2025-06-29 03:02:02 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
::: amqtt.contexts.WillConfig
|
|
|
|
options:
|
|
|
|
heading_level: 3
|
|
|
|
extra:
|
|
|
|
class_style: "simple"
|
2025-06-29 03:02:02 +00:00
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
::: amqtt.contexts.ConnectionConfig
|
|
|
|
options:
|
|
|
|
heading_level: 3
|
|
|
|
extra:
|
|
|
|
class_style: "simple"
|
2025-05-28 12:39:02 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
## Example
|
|
|
|
|
2025-07-26 16:37:25 +00:00
|
|
|
A more expansive `ClientConfig` in equivalent yaml format:
|
|
|
|
|
2025-05-28 12:39:02 +00:00
|
|
|
```yaml
|
|
|
|
|
|
|
|
keep_alive: 10
|
|
|
|
ping_delay: 1
|
2025-06-03 04:05:20 +00:00
|
|
|
default_qos: 0
|
2025-05-28 12:39:02 +00:00
|
|
|
default_retain: false
|
|
|
|
auto_reconnect: true
|
2025-06-03 04:05:20 +00:00
|
|
|
reconnect_max_interval: 5
|
2025-05-28 12:39:02 +00:00
|
|
|
reconnect_retries: 10
|
|
|
|
topics:
|
2025-07-26 16:37:25 +00:00
|
|
|
topic/subtopic:
|
2025-06-03 14:57:13 +00:00
|
|
|
qos: 0
|
2025-07-26 16:37:25 +00:00
|
|
|
topic/other:
|
2025-06-03 14:57:13 +00:00
|
|
|
qos: 2
|
|
|
|
retain: true
|
2025-06-03 04:05:20 +00:00
|
|
|
will:
|
|
|
|
topic: will/messages
|
|
|
|
message: "client ABC has disconnected"
|
|
|
|
qos: 1
|
|
|
|
retain: false
|
|
|
|
broker:
|
2025-07-26 16:37:25 +00:00
|
|
|
uri: 'mqtt://localhost:1883'
|
|
|
|
cafile: '/path/to/ca/file'
|
2025-06-29 03:02:02 +00:00
|
|
|
plugins:
|
|
|
|
- amqtt.plugins.logging_amqtt.PacketLoggerPlugin:
|
2025-05-28 12:39:02 +00:00
|
|
|
```
|