Main Content

MQTT Subscribe

Subscribe to an MQTT topic and receive message from the broker

Since R2023a

Add-On Required: This feature requires the Simulink Support Package for Android Devices add-on.

  • Android MQTT Subscribe block icon

Simulink Support Package for Android Devices / Communication


Use the MQTT Subscribe block to receive messages from the message queuing telemetry transport (MQTT) broker on the specified topic.



expand all

The port outputs the actual length of the data received from the MQTT broker.

Data Types: int32

The block outputs the data received from the MQTT broker as an array of ASCII characters.

Data Types: uint8


expand all

Specify a topic to which the client subscribes. A topic can have a maximum of 128 characters. For information on topics and their structure, see Topics in MQTT.

Specify the maximum length of the data you want to receive at each sample time.

Specify how often the client checks for a new message from the broker. When you specify the sample time as -1, the block inherits its sample time based on the context of the block within the model.

Version History

Introduced in R2023a