wialon/gmqtt

Created Feb 23, 2021 · View the wialon/gmqtt repository page

Python MQTT v5.0 async client

Want this for your repo?

Render a free sample of any GitHub repo in seconds.

Visualize your own →

Contributors

15

Lines of Code

305

From

Feb 19, 2018

To

Nov 23, 2020

About wialon/gmqtt

gmqtt is a Python MQTT v5.0 client library built on asyncio for asynchronous message broker communication. It supports the full MQTT 5.0 protocol specification with automatic version negotiation, falling back to MQTT 3.1 if a broker doesn't support the newer standard. The client handles all standard MQTT operations including publishing, subscribing, and message reception through callback functions.

The library provides comprehensive support for MQTT 5.0 features such as custom properties in connect and publish packets, subscription identifiers, topic aliases, message expiry intervals, and user-defined properties for diagnostic information. Developers can pass properties as keyword arguments when connecting or publishing, and the client automatically includes these in the appropriate protocol packets. The on_message callback can be defined as either synchronous or asynchronous, with async callbacks able to return specific PUBACK codes for advanced message handling.

Connection management includes built-in reconnection logic that attempts indefinite reconnects by default with configurable retry limits and delays. The library is compatible with Python 3.7 through 3.12 and is distributed via PyPI. Code examples demonstrate simple subscription patterns, property usage, custom reconnect strategies, and other common use cases within an examples directory.

Share this video