wotpy.protocols.mqtt.runner

Base class for MQTT handlers.

Classes

MQTTHandlerRunner(broker_url, mqtt_handler)

Class that wraps an MQTT handler.

class wotpy.protocols.mqtt.runner.MQTTHandlerRunner(broker_url, mqtt_handler, messages_buffer_size=500, timeout_loops=0.1, sleep_error_reconnect=2.0, ca_file=None, amqtt_config=None, username=None, password=None)

Bases: object

Class that wraps an MQTT handler. It handles connections to the MQTT broker, delivers messages, and runs the handler in a loop.

DEFAULT_CLIENT_CONFIG = {'keep_alive': 90}
DEFAULT_MSGS_BUF_SIZE = 500
DEFAULT_SLEEP_ERR_RECONN = 2.0
DEFAULT_TIMEOUT_LOOPS_SECS = 0.1
async connect(force_reconnect=False)

Connects to the MQTT broker.

async disconnect()

Disconnects from the MQTT broker.

async start()

Starts listening for published messages.

async stop()

Stops listening for published messages.