II. CONCEPT OF MQTT AND BASIC PARAMETERS
BROKER
Like other communication protocols MQTT has a server which is referred
to as Broker. The broker acts as a server which routes messages between
client and device/sensor. There are many MQTT brokers available for
testing and also for real time deployment.
TOPIC
MQTT topics are a form of addressing that allows MQTT clients to share
information. MQTT topics are structured in a hierarchy similar to
folders and files in a file system using the forward slash (/) as a
delimiter. Users can create naming structures of their own choosing.
There are certain limitations for choosing a topic name. Topic names
should always be case sensitive, it should use UTF-8 strings and at
least one character is to be valid. A client can subscribe to individual
or multiple topics [2].
Example topic name structure:
home/hall/light
SUBSCRIBE
Unlike HTTP, MQTT does not work on request response basis. It works on
publish subscribe method. Before sending a message to a device the
client should have subscribed to a particular topic in the broker from
where the data has to be fetched. It is not necessary to subscribe each
and every time to a topic in the broker, once subscribed the message is
received
PUBLISH
Once client has subscribed to the topic data gets published to the
broker which in turn publishes it to client.
UNSUBSCRIBE
If the client does not require any data from a particular topic, then it
can be unsubscribed from the broker.