Skip to main content

Weapons grade MQTT client.

Project description

The haka_mqtt package is reliable “weapons grade” MQTT client library. It contains a core mqtt reactor class built with provable reliability, and reproducibility as its fundamental goals. A side effect is that the library turns out to be speedy as well.

Status

The project’s core reactor is stable. It has been tested on systems with thousands of distributed nodes in difficult field conditions. The QoS=1 datapath is well field tested. The QoS=0 and QoS=2 are not as thoroughly field tested.

While the core reactor is very well tested the frontends are less tested. You should pay attention to notes on the different frontends regarding their status and use.

The haka library is mostly tested on Linux derivatives. It may work on other platforms but this has not been tested by the authors and no definite reports of success have been reported to the authors.

Installation

The haka-mqtt package can be installed from pypi.org with pip:

pip install haka-mqtt

Usage

A quick example of how the package can be used:

# Standard python Packages
import logging

# 3rd-Party Packages
from haka_mqtt.frontends.poll import (
    MqttPollClientProperties,
    BlockingMqttClient
)
from haka_mqtt.reactor import ACTIVE_STATES
from mqtt_codec.packet import MqttTopic

LOG_FMT='%(asctime)s %(name)s %(levelname)s %(message)s'
logging.basicConfig(format=LOG_FMT, level=logging.INFO)

properties = MqttPollClientProperties()
properties.host = 'test.mosquitto.org'
properties.port = 1883
properties.ssl = False

TOPIC = 'haka'

c = BlockingMqttClient(properties)
c.start()
sub_ticket = c.subscribe([MqttTopic(TOPIC, 1)])
c.on_suback = lambda c, suback: c.publish(TOPIC, 'payload', 1)
c.on_publish = lambda c, publish: c.stop()

while c.state in ACTIVE_STATES:
    c.poll(5.)

Project Infrastructure

The project is coordinated through public infrastructure available at several places:

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

haka-mqtt-0.3.5.tar.gz (29.5 kB view hashes)

Uploaded Source

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