MqttTransport
- class compas_eve.mqtt.MqttTransport[source]
Bases:
Transport,EventEmitterMixinMQTT transport allows sending and receiving messages using an MQTT broker.
- Parameters:
- hoststr
Host name for the MQTT broker, e.g.
broker.hivemq.comorlocalhostif 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.
- codec
MessageCodec, optional The codec to use for encoding and decoding messages. If not provided, defaults to
JsonMessageCodec.
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*argsand**kwargsto each attached function.Returns a list of all listeners registered to the
event.Removes the function
ffromevent.Registers the function (or optionally an asyncio coroutine function)
fto 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
ffromevent.