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()

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.3.tar.gz (10.4 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.3-py3-none-any.whl (9.8 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymosquitto-0.1.3.tar.gz
  • Upload date:
  • Size: 10.4 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.3.tar.gz
Algorithm Hash digest
SHA256 1e626693d171f8f5c7266cebeb5eb9c4027f4853014ecd6e34930162cf42377a
MD5 ba7db3aa214a87f63dd1fadb8687a361
BLAKE2b-256 1119c4277ad8bb54c66d964cdcaab63915197b0c686965470ea6e00e1512c257

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymosquitto-0.1.3-py3-none-any.whl
  • Upload date:
  • Size: 9.8 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.3-py3-none-any.whl
Algorithm Hash digest
SHA256 1df57192b78a3a805bcfea107330d0250988883b8dd8f706af5b0f194d241751
MD5 adac7b6882c61d11f435bb7fda21b973
BLAKE2b-256 264d4bf9d765e190004aff69ca00221f7d08e890e953ed6d17ea1651e30c6c3e

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