A tiny, modern MQTT/UDP client.
Tip
To learn how MQTT/UDP is different from traditional MQTT, read this.
- Brokerless broadcasting of MQTT messages
- Fire-and-forget
- Reliable transmission support with QoS level 1
- Polling using
SUBSCRIBEmessages - Ping messages for client discovery
- No dependencies and single-file distributable for easy vendoring and embedded systems
MQTT/UDP is based on MQTT v3.1.1 but it does not aim to be 100% compatible. The following are not implemented nor planned:
CONNECT,CONNACK,SUBACK,UNSUBSCRIBE,UNSUBACK,DISCONNECT, andAUTHmessagesPUBREC,PUBREL, andPUBCOMP(QoS level 2)- Packet Identifier in
SUBSCRIBEmessages - Multiple topics in
SUBSCRIBEmessages - Retained messages
- Authentication
- Message Properties
The following are not done automatically but can be easily implemented by the user:
- Replying to
PUBLISHwithPUBACK(QoS level 1) - Replying to
PINGREQwithPINGRESP - Resending unacknowledged messages
These are the most bare-bones examples to get you started.
Sending messages:
from mqtt_udp import Client
with Client() as client:
client.publish("demo/topic", b"hello")Receiving messages:
from mqtt_udp import Client
with Client() as client:
for packet in client.listen():
print(packet)For more complete examples that you can use right away, check out the examples directory.
This implementation is based on this desciption of MQTT/UDP by Dmitry Zavalishin. Many thanks to him for the idea and prior work!