adata.mqtt module

MQTT Client

Machine Queue Telemetry Transport

class Broker(host, port=1883)

Bases: object

A MQTT broker connection

Parameters:
  • host (string) – IP or DNS name of the broker.
  • port (int) – Optional port - default 8080
StopHandler()

Stop any running loop.

auth(user, password)

Set credentials before connect.

Parameters:
  • user (string) – user
  • password (string) – password
connect(on_connect=None, on_message=None)

Connect to the service.

Parameters:
  • on_connect (function) – connection handler
  • on_message (function) – message handler
publish(topic, payload)

Send one MQTT message.

subscribe(topic='#')

Subscribe to a topic and echo received messages.

Blocks this thread until app.stop signal to disconnect.

Previous topic

adata.main module

Next topic

adata.pubsub module