Skip to main content

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

fastmqtt-0.1.5.tar.gz (7.9 kB view hashes)

Uploaded Source

Built Distribution

fastmqtt-0.1.5-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page