--- id: gmqtt version: "0.7.0" license: MIT license_treatment: permissive maintenance: active --- # gmqtt — Client for MQTT protocol License: permissive · Maintenance: active · Downloads: 159.4K/mo ## What it is and what it does gmqtt is a pure-Python async MQTT client library built on asyncio for connecting to MQTT brokers and exchanging messages. It implements both MQTT 5.0 (default) and 3.1.1 protocols, with automatic downgrade if a broker does not support version 5.0. The client handles subscriptions, message publishing with configurable QoS levels, authentication, and automatic reconnection with tunable retry behavior. The library is callback-driven: you define handlers for connect, message receipt, disconnect, and subscribe events, then await the main connection loop. It supports MQTT 5.0 properties (session expiry, maximum packet size, user properties, content type, message expiry) and allows both synchronous and asynchronous message handlers. No external dependencies are required beyond Python's standard asyncio, making it lightweight and straightforward to integrate into async applications. Use it for: - Build IoT device clients that publish sensor data and subscribe to control commands over MQTT. - Create real-time message brokers or gateways that relay MQTT traffic between multiple topics or brokers. - Implement monitoring dashboards that subscribe to device telemetry and display live updates. - Develop async Python services that need to communicate via MQTT without blocking the event loop. - Test MQTT broker behavior and message flow by scripting client interactions in Python. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. gmqtt is an async Python MQTT client that connects to MQTT brokers, publishes and subscribes to topics, and handles message delivery with support for MQTT 5.0 and 3.1.1 protocols. Yes. gmqtt is a solid, actively maintained MQTT client with zero dependencies, permissive licensing, and broad protocol support. Install it if you need async MQTT connectivity in Python and are comfortable with callback-based event handling. The 630 days since last release is not a concern given the active repository and recent commits; the library is stable rather than abandoned. ## Install pip install gmqtt uv add gmqtt poetry add gmqtt ## Installing gmqtt Before you install: Low friction: pure Python wheel with no runtime dependencies. Actively maintained with recent commits and a stable release history since 2018. License in practice: MIT license is permissive; you can use, modify, and distribute gmqtt freely in commercial and open-source projects with minimal restrictions. Quickstart: pip install gmqtt import asyncio from gmqtt import Client as MQTTClient async def main(): client = MQTTClient("client-id") client.on_message = lambda c, t, p, q, pr: print(p) await client.connect("mqtt.broker.host") client.subscribe("topic/name") await asyncio.sleep(10) await client.disconnect() asyncio.run(main()) Requires Python 3.5 or later and an accessible MQTT broker at connection time. Verify before relying: - Whether uvloop integration (mentioned in docs) provides measurable performance gains for typical workloads. - Behavior and compatibility with brokers that do not support MQTT 5.0 downgrade negotiation. - Performance characteristics under high message throughput or with many concurrent subscriptions. ## Package facts - License: MIT (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 159.4K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags mqtt client python async, mqtt publish subscribe, mqtt 5.0 protocol, asyncio mqtt broker, mqtt message handling, mqtt reconnect, mqtt qos delivery, mqtt, asyncio, iot [View on SkillFed](https://skillfed.io/packages/gmqtt) · [View on PyPI](https://pypi.org/project/gmqtt/)