aiomqtt
The idiomatic asyncio MQTT client
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 on this page — 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
aiomqtt on PyPI
pip
pip install aiomqttuv
uv add aiomqttpoetry
poetry add aiomqttInstalling 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 the current Python release (<4.0,>=3.8) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 2 — paho-mqtt, typing-extensions |
| Maintenance | actively maintained — 162 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 1,161,075/month — #4,284 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: aiomqtt-2.5.1-py3-none-any.whl
Keywords: asyncio, internet-of-things, iot, mqtt, mqttv5, paho-mqtt
Tags
More Internet packages
Botocore provides low-level, data-driven access…
permissive · top 100 on PyPI
aiobotocoreProvides an async client for AWS services using…
permissive · top 100 on PyPI
pydanticPydantic validates Python data structures…
permissive · top 100 on PyPI
filelockProvides a platform-independent file locking…
permissive · top 100 on PyPI
fastapiFastAPI is a Python web framework for building…
permissive · top 100 on PyPI
googleapis-common-protosProvides common Protocol Buffer message…
permissive · top 100 on PyPI
asyncio-mqttProvides an async/await interface to MQTT…
permissive · top 15,000 on PyPI
gmqttgmqtt is an async Python MQTT client that…
permissive · top 15,000 on PyPI
paho-mqttProvides an MQTT client library for connecting…
copyleft · top 5,000 on PyPI
tb-paho-mqtt-clientProvides an MQTT client library implementing…
copyleft · top 15,000 on PyPI
telegraphTelegraph is a Python wrapper for the Telegraph…
permissive · top 15,000 on PyPI
gcloud-aio-pubsubAsyncio and threadsafe Python client for Google…
permissive · top 15,000 on PyPI
types-paho-mqttProvides type stubs for paho-mqtt 1.6.* to…
permissive · top 15,000 on PyPI
victron-mqttAn asynchronous Python library for…
permissive · top 15,000 on PyPI
yoto-apiAsync Python client for controlling Yoto player…
permissive · top 15,000 on PyPI
pyimouapiAsync Python client for Imou Open Platform…
permissive · top 15,000 on PyPI