Skip to main content

A lightweight Python MQTT client implemented as a thin wrapper around libmosquitto

Project description

PyMosquitto

A lightweight Python MQTT client implemented as a thin wrapper around libmosquitto.

Dependencies

  • python3.8+
  • libmosquitto1

Installation

  • pip install pymosquitto

Usage

from pymosquitto.client import MQTTClient


def on_message(client, userdata, msg):
    print(msg)


client = MQTTClient()
client.on_connect = lambda *_: client.subscribe("#", 1)
client.on_message = on_message
client.connect_async("localhost", 1883)
client.loop_forever()

Check out more examples in tests/test_client.py.

Benchmarks

Receiving 1 million messages with QoS 0.

*The memory plots exclude the Python interpreter overhead (~10.4 MB).

benchmark-results

Losers excluded:

benchmark-results-fast

benchmark.csv

Module;Time;RSS
pymosq;0:05.45;17724
paho;0:09.73;23252
aiomqtt;0:54.16;578064
amqtt;0;0
gmqtt;0:04.51;25152

License

MIT

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

pymosquitto-0.1.5.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pymosquitto-0.1.5-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file pymosquitto-0.1.5.tar.gz.

File metadata

  • Download URL: pymosquitto-0.1.5.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pymosquitto-0.1.5.tar.gz
Algorithm Hash digest
SHA256 f7ef2f7dd18e8bb8d64f0921e7804644382e53e6129d4b5901b4e1754b179593
MD5 7ca8a8947a200f61cf1a4ea5a7e3541d
BLAKE2b-256 cf0ae1379a02902df05d6e41ed97bf8c1ec0d1d1e176676a89a2ef9f1ea0c498

See more details on using hashes here.

File details

Details for the file pymosquitto-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: pymosquitto-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pymosquitto-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 998fc66b503d68413068abfc3f3082734ed004577a9d13e285e36cf41c7c4cc6
MD5 19f3c37e60feb729ff21523a3eeb8c17
BLAKE2b-256 86dec0730452607d79ad5b6cc2a2358e2a919c69d51cc9643ca5a4579d87f76d

See more details on using hashes here.

Supported by

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