Skip to main content

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

mqtt-router-0.1.1.tar.gz (6.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

mqtt_router-0.1.1-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file mqtt-router-0.1.1.tar.gz.

File metadata

  • Download URL: mqtt-router-0.1.1.tar.gz
  • Upload date:
  • Size: 6.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.9

File hashes

Hashes for mqtt-router-0.1.1.tar.gz
Algorithm Hash digest
SHA256 36f0ca8e79cea1899413d2a40336c97130d538ab284c02255ed9ecf18ea7502c
MD5 8403fd3b5134bc38483ea055ee4fd97b
BLAKE2b-256 c56bdc42bae58c8df10886cfc9d582f9753017753a38f843c6e817a5c9f0b64d

See more details on using hashes here.

File details

Details for the file mqtt_router-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: mqtt_router-0.1.1-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

Hashes for mqtt_router-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 23b59db16ac5ddfc3a165b6639be8976cb499a56db708ef037fb52c015a57df0
MD5 f1a43450c90fd15635f657933050826b
BLAKE2b-256 571ae3667550b9f536d6794e36c8bd426095bc6aa3b1197f8139b5da541cedbc

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page