2025-05-21 13:53:46 +00:00
# Broker API reference
2015-11-06 22:02:19 +00:00
2025-05-21 13:53:46 +00:00
The `amqtt.broker.Broker` class provides a complete MQTT 3.1.1 broker implementation. This class allows Python developers to embed a MQTT broker in their own applications.
2015-11-13 21:07:58 +00:00
2025-05-21 13:53:46 +00:00
## Usage example
2015-11-13 21:07:58 +00:00
The following example shows how to start a broker using the default configuration:
2025-05-21 13:53:46 +00:00
```python
2025-06-09 18:32:55 +00:00
--8< -- " samples / broker_simple . py "
2025-05-21 13:53:46 +00:00
```
2025-05-28 11:45:12 +00:00
This will start the broker and let it run until it is shutdown by `^c` .
2025-05-21 13:53:46 +00:00
## Reference
### Broker API
The `amqtt.broker` module provides the following key methods in the `Broker` class:
- `start()` : Starts the broker and begins serving
- `shutdown()` : Gracefully shuts down the broker
2025-05-22 01:59:12 +00:00
::: amqtt.broker.Broker