Skip to main content

Simple client agnostic MQTT message router

Project description

MQTT Router

MQTT Router is a simple to use client-agnostic mqtt message router.

You can use mqtt-router to declare 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.3.tar.gz (7.0 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.3-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: mqtt-router-0.1.3.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

Hashes for mqtt-router-0.1.3.tar.gz
Algorithm Hash digest
SHA256 4676e1b901015d9d45631fc3cfd4a3e9cdaef81046993ea9dd4ac9eda083d097
MD5 7b86923a70a61f2dfcbd84fc95a51e50
BLAKE2b-256 0e8c5272f97cbbd907eaecbf82de6e3feb1b93ddbd7bbbef69f149dc43024848

See more details on using hashes here.

File details

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

File metadata

  • Download URL: mqtt_router-0.1.3-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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 735b6264f8e66bbfe19c5b30b2f9c8e3e33fd61c13c26b01f2ea7851d03d41c7
MD5 4a5f607e03d6966f4b3f56ff3d073923
BLAKE2b-256 530ddea727d0aeac5506249e6ba3496023e2e806755102476c47e185cd7a6863

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