MqttTransport
- class compas_eve.mqtt.MqttTransport[source]
Bases:
Transport
,EventEmitterMixin
MQTT transport allows sending and receiving messages using an MQTT broker.
- Parameters:
- hoststr
Host name for the MQTT broker, e.g.
broker.hivemq.com
orlocalhost
if you are running a local broker on your machine.- portint
MQTT broker port, defaults to
1883
.- client_idstr, optional
Client ID for the MQTT connection. If not provided, a unique ID will be generated.
Methods
Announce this code will publish messages to the specified topic.
Close the connection to the MQTT broker.
Allows to hook-up to the event triggered when the connection to MQTT broker is ready.
Publish a message to a topic.
Subscribe to a topic.
Announce that this code will stop publishing messages to the specified topic.
Unsubscribe from the specified topic.
Unsubscribe from the specified topic based on the subscription id.
Inherited Methods
Emit
event
, passing*args
and**kwargs
to each attached function.Returns a list of all listeners registered to the
event
.Removes the function
f
fromevent
.Registers the function (or optionally an asyncio coroutine function)
f
to the event nameevent
.The same as
ee.on
, except that the listener is automatically removed after being called.Remove all listeners attached to
event
.Removes the function
f
fromevent
.