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.4.tar.gz (10.5 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.4-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: pymosquitto-0.1.4.tar.gz
  • Upload date:
  • Size: 10.5 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.4.tar.gz
Algorithm Hash digest
SHA256 a0c0cbd34a64b11d724b9cc8bb556aa865cefca4d2d46f40d7a88c9551d356e3
MD5 2c5b7737c0d541dd2c503ae49e61b370
BLAKE2b-256 123ee76fe7be45a34725befcd47735ce0ef796926b8fbb1a49bd32d312cbb78b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: pymosquitto-0.1.4-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.4-py3-none-any.whl
Algorithm Hash digest
SHA256 913ac0e405aaa934dd2df6afded660f825759f2d792d05c4d83481e9b86a2819
MD5 617ddbe2707b3975f0e9e8e5c9b68aa1
BLAKE2b-256 e9d883d506bbf4649899c4dad9d104d916b585c7eb014106831169872856ab08

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