The broker and MQTT act as a simple, common
interface for everything to connect to
Messages in MQTT are published on topics
no need to
configure a topic, publishing on it is enough
Topics are treated as a
hierarchy, using a slash (/) as a separator.
Clients can receive messages by creating subscriptions
A
subscription may be to an explicit topic
Two
wildcards are available, + or #.
# can be used as a wildcard for all remaining levels of
hierarchy
+ can be used as a wildcard for a single level
of hierarchy
Zero length topic levels are valid, which can lead to some
slightly non-obvious behaviour.
The QoS
defines how hard the broker/client will try to ensure that a message is
received.
Messages may be sent at any QoS level, and clients may
attempt to subscribe to topics at any QoS level
the
client chooses the maximum QoS it will receive
if
a client is subscribed with QoS 2 and a message is published on QoS 0,
the client will receive it on QoS 0.
1: The broker/client will deliver the message at least once, with confirmation required.
All messages may be set to be retained.
the
broker will keep the message even after sending it to all current
subscribers
useful as a "last known good" mechanism
If clean session is set
to false, then the connection is treated as durable
when the client disconnects, any subscriptions it has will remain and
any subsequent QoS 1 or 2 messages will be stored until it connects
again in the future
If clean session is true, then all subscriptions
will be removed for the client when it disconnects