--- id: aiomqtt version: "2.5.1" license: unclear license_treatment: permissive maintenance: active --- # aiomqtt — The idiomatic asyncio MQTT client License: permissive · Maintenance: active · Downloads: 1.2M/mo ## What it is and what it does aiomqtt is an asyncio wrapper around paho-mqtt that replaces callback-based MQTT programming with async/await patterns. Instead of registering on_publish, on_subscribe, and on_disconnect callbacks, you write linear async code using context managers and async iteration. It supports MQTT 5.0, 3.1.1, and 3.1, is fully type-hinted, and raises MqttError exceptions instead of returning numeric error codes. The package is designed for developers building IoT applications, real-time data pipelines, or other systems that need to publish or subscribe to MQTT topics without blocking. It has been actively maintained since 2017, supports Python 3.8 through 3.13, and carries no known security vulnerabilities. The only gotcha is a Windows-specific event loop configuration requirement documented in the description. Use it for: - Publish sensor readings to an MQTT broker from an asyncio application without blocking other concurrent tasks. - Subscribe to multiple MQTT topics and process incoming messages in an async for loop within a larger async application. - Build IoT gateways or data aggregators that need to handle many concurrent MQTT connections with clean async/await syntax. - Integrate MQTT messaging into async web frameworks or other asyncio-based services. - Replace callback-heavy paho-mqtt code with readable linear async code in new projects. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. An asyncio-native MQTT client that wraps paho-mqtt to provide async/await syntax for publishing and subscribing to MQTT brokers, supporting MQTT versions 5.0, 3.1.1, and 3.1. Yes. The package is actively maintained, has no known vulnerabilities, low install friction, and solves a real pain point—callback-based MQTT programming—with a clean async/await API. It is well-suited for any asyncio application that needs MQTT. The Windows event loop caveat is documented and straightforward to work around. ## Install pip install aiomqtt uv add aiomqtt poetry add aiomqtt ## Installing aiomqtt Before you install: Low friction: pure Python wheel with only paho-mqtt and typing-extensions as runtime dependencies. Active maintenance with recent commits and no known vulnerabilities. License in practice: BSD 3-clause permissive license. The underlying paho-mqtt dependency is dual-licensed under BSD 3-clause and Eclipse Distribution License v1.0, both permissive. Quickstart: pip install aiomqtt import asyncio from aiomqtt import Client async def main(): async with Client("test.mosquitto.org") as client: await client.publish("temperature/outside", payload=28.4) asyncio.run(main()) On Windows with Python 3.8+, the default ProactorEventLoop does not support the add_reader method required by aiomqtt; you must switch to SelectorEventLoop before running. Verify before relying: - Whether the package handles reconnection and backpressure automatically or requires explicit handling in user code. - Performance characteristics and latency overhead compared to direct paho-mqtt usage. ## Package facts - License: not declared (permissive) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 1.2M/month (top 5,000 on PyPI) - Known vulnerabilities: none known ## Tags asyncio mqtt client, async mqtt publish subscribe, mqtt5 python async, iot messaging asyncio, mqtt broker client async, paho mqtt wrapper asyncio, non-blocking mqtt, mqtt, asyncio, iot [View on SkillFed](https://skillfed.io/packages/aiomqtt) · [View on PyPI](https://pypi.org/project/aiomqtt/)