/mqttproto

Sans-IO MQTT v5 protocol implementation for Python

Primary LanguagePythonMIT LicenseMIT

Build Status Code Coverage Documentation

This library contains a sans-io implementation of the MQTT v5 protocol.

Contents:

  • State machines appropriate for implementing MQTT clients and brokers
  • Asynchronous client and broker implementations, compatible with both Trio and asyncio, via the AnyIO library
  • Synchronous client implementation, implemented by using an asyncio event loop thread behind the scenes

While the provided client I/O implementations are intended for production use, the broker implementation should only be used in very lightweight scenarios where high performance or a broad feature set are not required. In those cases, broker implementations from vendors like EMQX or HiveMQ are recommended instead.

The state machine implementation tries to adhere to the MQTT v5 protocol as tightly as possible, and this project has certain automatic safeguards to ensure correctness:

  • Ruff linting
  • Passes Mypy in strict mode
  • Documentation built with "fail-on-warning" enabled

You can find the documentation here.