Skip to main content

A wrapper around Python Paho Mqtt library

Project description

Drift MQTT tools

GitHub Workflow Status PyPI PyPI - Downloads

A collection of helpers to work with MQTT:

  • Client - wrapper around paho.mqtt.Client that correctly handles subscriptions after reconnect

Installation

pip install drift-mqtt

Or get the latest version from GitHub:

pip install git+https://github.com/panda-official/DriftMqtt.git

Usage

Producer

from drift_mqtt import Client


client = Client('tcp://127.0.0.1:8000', 'client_id')
client.connect()
client.loop_start()
...
client.publish('topic', 'some message')

Consumer

from drift_mqtt import Client


def message_handler(message):
    print('Got message ', message.payload, message.topic)


client = Client('tcp://127.0.0.1:8000', client_id='test_subscriber')
client.subscribe('test_topic', message_handler)
client.connect()
client.loop_forever()

For more details please check examples/ folder

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

drift_mqtt-0.2.2-py3-none-any.whl (9.5 kB view details)

Uploaded Python 3

File details

Details for the file drift_mqtt-0.2.2-py3-none-any.whl.

File metadata

  • Download URL: drift_mqtt-0.2.2-py3-none-any.whl
  • Upload date:
  • Size: 9.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.9.18

File hashes

Hashes for drift_mqtt-0.2.2-py3-none-any.whl
Algorithm Hash digest
SHA256 5d021b98b0bcefc20275c3c58b4450b76efff6f66e8f835511dc84bde4114c82
MD5 97b67aeb4f99aa7dc15bb9fc670b4e73
BLAKE2b-256 77250f8162eaa0ed80bde1168c8612dc7cd959e40f487793d263ab60482f964e

See more details on using hashes here.

Supported by

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