Skip to content

thomaskoller/FastMQTT

Repository files navigation

FastMQTT

FastMQTT is a wrapper of the paho-mqtt package which uses typing to parse the incoming message. Additionally one can use pydantic to get a validated model from an incoming json.

Example

from fastmqtt import FastMQTT
import pydantic

class Payload(pydantic.BaseModel):
    param: str

app = FastMQTT(host="localhost")

@app.subscribe(topic="some/topic")
def some_topic(msg=Payload):
    """
    The some_topic function will be called 
    when a new message arrives at the topic 'some/topic'.
    The msg will be parsed automatically by it's defined type.
    """
    print(msg.param)

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages