SARA-R4/N4 series-AT Commands Manual
UBX-17003787 - R09

24MQTT
Page 247 of 307
24î™–î™–î™–î™–MQTT
The MQ Telemetry Transport (MQTT) protocol specifies a simple and lightweight messaging protocol,
designed for constrained devices and low-bandwidth, high-latency, or unreliable networks. An MQTT client
uses publish and subscribe methods to interact over a TCP connection with an MQTT message broker
(henceforth referred to as an MQTT server). The u-blox modules can be configured to operate as an MQTT
client.
To publish or subscribe, the MQTT client must first establish a TCP connection to an MQTT server.
The MQTT protocol specifies case-sensitive Topics, with Topic Names containing Topic Level separators "/" to
which messages will be published. For example, a message of "78 Fahrenheit or 25 Celsius" could be published
to the Topic Name of "/heat/sensor/SD/bldg5/DelMarConfRm". MQTT clients subscribe to Topic Filters to
determine if the client receives messages published to a given Topic name.
The Topic Filters may exactly specify a Topic Name or may contain either of the following wildcards:
• '+' - (Single level wildcard) applies to a single Topic Level
• '#' - (Multi-level wildcard) applies to potentially many Topic Levels (and must be the last character specified
in a Topic Filter);
'#' can be specified on its own or following a topic level separator ('/'). For example, the Topic Filter, "/heat/
sensor/SD/#", would receive any messages published to the "/heat/sensor/SD/bldg5/DelMarConfRm" Topic
Name.
MQTT specification states that Topic Filters starting with either wildcard will not match any Topic Name
that starts with "$".
The MQTT protocol also specifies a Quality of Service (QoS) level to be applied to message transactions:
• 0 - At most once delivery [default]
• 1 - At least once delivery
• 2 - Exactly once delivery
The MQTT protocol also allows an MQTT client to create a Will message, which the MQTT remote server
will store and only publish (to the Topic name specified as the Will Topic name) when the MQTT client gets
disconnected from the MQTT server, but not if the MQTT client explicitly sends a disconnect command.
24.1î™–î™–î™–î™–MQTT profile configuration +UMQTT
+UMQTT
SARA-R410M-02B SARA-R410M-52B SARA-R412MModules
SARA-N4
Syntax PIN required Settings saved Can be aborted Response time Error referenceAttributes
full No No No - MQTT Error
24.1.1î™–î™–î™–î™–Description
Configures or reads the parameter value of an MQTT client profile. Issue a set command for each <op_code>
parameter to set all of the parameters in an MQTT client profile.
24.1.2î™–î™–î™–î™–Syntax
Type Syntax Response Example
Generic syntax
Set AT+UMQTT=<op_code>[,
<param1>[,<param2>]]
+UMQTT: <op_code>,<result>
OK
AT+UMQTT=12,1
+UMQTT: 12,1
OK
MQTT unique client ID
Set AT+UMQTT=0,<client_id> +UMQTT: 0,<result>
OK
AT+UMQTT=0,"352753090041680"
+UMQTT: 0,1
OK
MQTT local TCP port number