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, hbmqtt_config=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
connect(force_reconnect=False)

Connects to the MQTT broker.

disconnect()

Disconnects from the MQTT broker.

start()

Starts listening for published messages.

stop()

Stops listening for published messages.