Subscribe

This method is used by the client to signal to the broker that it wants to receive all MQTT message with a particular topic. The method can subscribe an MQTT client instance to multiple topics.
Syntax
METHOD Subscribe : BOOL
VAR_IN_OUT
sTopic : STRING; // topic string (UTF-8) with any length (attend that MQTT topics are case sensitive)
END_VAR
VAR_INPUT
eQoS : TcIotMqttQos; // quality of service between the publishing client and the broker
END_VAR
Return value
Name | Type | Description |
---|---|---|
Subscribe | BOOL | The method returns the return value TRUE if the call was successful. |
Inputs
Name | Type | Description |
---|---|---|
eQoS | TcIotMqttQos | "Quality of Service"
|
Inputs/outputs
Name | Type | Description |
---|---|---|
sTopic | STRING | Topic of the MQTT message |
Possible errors are output at the outputs bError and hrErrorCode of the function block instance.