No project description provided
Project description
FastMQTT
A performant, flexible, and user-friendly MQTT client library built on top of aiomqtt. FastMQTT simplifies message handling, advanced subscriptions, and convenient request-response patterns within the MQTT protocol.
Key Features
- Efficient Message Handling: Streamlined asynchronous message processing.
- Robust Router: Define topic-based message routing with QoS, no_local, retain options.
- Subscription Management: Effortlessly manage subscriptions, including retained messages.
- Request-Response Patterns: Convenient
ResponseContext
for request-response communication over MQTT. - Correlation Tracking: Automatic correlation ID generation to match responses with their requests.
- aiomqtt Foundation: Built upon the reliable aiomqtt library for core MQTT functionality.
Installation
pip install fastmqtt
Basic Usage
import asyncio
from fastmqtt import FastMQTT, Message, MQTTRouter
router = MQTTRouter()
@router.on_message("my/topic") # Subscribe and handle incoming messages
async def message_handler(message: Message):
print(f"Message received: {message.payload.text()} on topic {message.topic}")
async def main():
fastmqtt = FastMQTT("test.mosquitto.org", routers=[router])
async with fastmqtt: # Connect and automatically handle subscriptions
await fastmqtt.publish("my/topic", "Hello from FastMQTT!")
await asyncio.sleep(5) # Keep running for a bit
if __name__ == "__main__":
asyncio.run(main())
Contributions
We welcome contributions to improve FastMQTT! Please open issues for bug reports or feature suggestions, and fork the repository to submit pull requests.
Let me know if you'd like modifications or have specific aspects you want to emphasize in the README!
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file fastmqtt-0.1.2.tar.gz
.
File metadata
- Download URL: fastmqtt-0.1.2.tar.gz
- Upload date:
- Size: 7.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 189e8013b32290d8695f57aac5f77d9009bbae4e9d05c5e23bb86c7ed6afd008 |
|
MD5 | 161de3c472f597410feaabe606ba0434 |
|
BLAKE2b-256 | 05f95d8fdf1f75c9d82a7a373839665ef15e23c5f4452e777ee4fa5013ff24d9 |
File details
Details for the file fastmqtt-0.1.2-py3-none-any.whl
.
File metadata
- Download URL: fastmqtt-0.1.2-py3-none-any.whl
- Upload date:
- Size: 10.1 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/5.0.0 CPython/3.12.2
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7ec2fd3d3ef6b44b208309f690060e98bcb3278b425964842110f4bb5babaa1 |
|
MD5 | d8ca421de5f0fada54b470560d71a560 |
|
BLAKE2b-256 | 9817ed42f93e9c6a9b350887c65db869e67a7afec2987096e3424c5ec296596c |