Simple client agnostic MQTT message router
Project description
MQTT Router
MQTT Router a simple client agnostic mqtt message router based on topic.
You can use mqtt-router to organize mqtt message handlers using a simple and minimal python decorator syntax.
mqtt-router helps you extract parameters from topics that contains wildcards and cast those parameters into the desired python data type.
Getting Started
Install the library using Pip:
pip install mqtt-router
Using mqtt-router
from mqtt_router import MQTTRouter
router = MQTTRouter()
# Subscribe to telemetry/#/#/data
@router.add("telemetry/<str:streaming_key>/<int:count>/data")
def handle_meta(message, context, streaming_key=None, count=None):
...
# Subscribe to telemetry/+
@router.add("telemetry/<path:rest>")
def handle_rest(message, context, rest=None):
...
def on_message(message, topic, client, userdata):
router.route(topic, message, context={"client": client, "userdata": userdata})
mqtt_client.on_message = on_message
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mqtt-router-0.1.2.tar.gz.
File metadata
- Download URL: mqtt-router-0.1.2.tar.gz
- Upload date:
- Size: 7.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fbbcfa9262df4ab4d187f390c1256ec912f4b4ac8a29565236d07f4aea2ac2e8
|
|
| MD5 |
83f93a780deb733021fb35ebb1bacfbc
|
|
| BLAKE2b-256 |
5feb40cdcce8f14ac8c6bf43bd73c58599ea49bfa5ba2a9a25ed717fd5eb0c1c
|
File details
Details for the file mqtt_router-0.1.2-py3-none-any.whl.
File metadata
- Download URL: mqtt_router-0.1.2-py3-none-any.whl
- Upload date:
- Size: 4.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.11.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cbf1ff030e54965260b4e3227e563c9c90edbadf969225f9121f1bc0feaaa5d9
|
|
| MD5 |
3dd5f1b140dd5e8501d2eda584d3c338
|
|
| BLAKE2b-256 |
1825f3b5ea3b4b2e4047185c3fd29897de7ea0ec8328bd8d69a2767b07ad6662
|