Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Alurith/litestar-mqtt
A Litestar package for the MQTT protocol, ported from fastapi-mqtt
https://github.com/Alurith/litestar-mqtt
Last synced: about 1 month ago
JSON representation
A Litestar package for the MQTT protocol, ported from fastapi-mqtt
- Host: GitHub
- URL: https://github.com/Alurith/litestar-mqtt
- Owner: Alurith
- License: mit
- Created: 2023-05-01T12:09:10.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2023-08-31T08:26:29.000Z (over 1 year ago)
- Last Synced: 2024-05-11T22:45:07.675Z (7 months ago)
- Language: Python
- Size: 66.4 KB
- Stars: 4
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-litestar - `litestar-MQTT` - A plugin for the MQTT protocol. (Third-Party Extensions / General)
README
# litestar-mqtt
Litestar-mqtt is porting of [Fastapi-mqtt](https://github.com/sabuhish/fastapi-mqtt) for the [Litestar framework](https://github.com/litestar-org/litestar).
For more information about MQTT, please refer to the [Fastapi-mqtt MQTT](https://github.com/sabuhish/fastapi-mqtt/blob/master/MQTT.md) documentation.
As Fastapi-mqtt, Litestar-mqtt wraps around [gmqtt](https://github.com/wialon/gmqtt) module.
---
## Features:
Litestar-mqtt implements the same feature of Fastapi-mqtt and also:
- Load configurations via ```.env``` file```env
MQTT_HOST="mqtt-dashboard.com"
```
---
## Installation:
```sh
$ pip install litestar-mqtt
```
or
```sh
$ poetry add litestar-mqtt
```
---
## Differences:
Litestar-mqtt must be hooked to the ```on_startup``` and ```on_shutdown``` handlers.```python
app = Litestar(
route_handlers=[test_func],
on_startup=[lite_mqtt.startup],
on_shutdown=[lite_mqtt.shutdown],
)
```