IoT
MQTT Client Test
1/ Introduction :
Definition of IoT:
The Internet Of Things, or IoT, refers to billions of physical devices around the world that are now connected to the internet, collecting and sharing data. Thanks to cheap processors and wireless networks, it's possible to turn anything, from to an airplain, into part of the IoT. This adds a level of digital intelligence to devices that would be otherwise “dumb”, enabling them to communicate without a human being involved, and merging the digital and physical worlds.
Web communication protocols :
Approaching the IoT world, one can be amazed by how many protocols we can use to
communicate IoT devices. There are many protocols such as AMQP, CoAP, MQTT and the
omnipresence HTTP. Trying to stay in the practical world, we can shortly compare two of
them: MQTT and HTTP.
a) HTTP (Hyper Text Transfer Protocol):
Most of us know about this, HTTP connection between client (web user) and web server.
It is the common used protocol for the Internet, and likely to be the most used for IoT devices
that need to publish a lot of data. It uses normal IP header for routing of packets and data are
not encrypted before transmission.
The protocol also allows information to be sent to the server from the client using a few different
methods (verbs), in my case I’ve used the POST verb to (write) data in the server.
b) MQTT prtocol :
MQTT stands for Message Queuing Telemetry Transport .MQTT is designed as a machine-tomachine (M2M) & IoT connectivity protocol.
MQTT is a light-weight that is often supported by
some of the smallest measure and monitoring devices. Thus, it can transmit information over
way reaching, sometimes intermittent networks. Simple MQTT protocol architecture is broker
based.
MQTT has likely a short specification.
There are only :
- CONNECT
- PUBLISH
- SUBSCRIBE
- UNSUBSCRIBE
- DISCONNECT
types that are significant for developers.
Figure : MQTT protocol Architecture
MQTT client can publish messages as soon as he is connected to a broker. MQTT utilizes topicbased filtering of the messages on the broker .The Topic can be temperature, light, vibration,
humidity, or movement, etc…
Publishing a message doesn’t make sense if no one ever receives it. In other words, if there are no clients to subscribe to the topics of the messages, publishing is useless.
Figure : Publish/Subscribe structure MQTT network
c) Message broker :
In a telecommunication network where programs communicate by exchanging formally-defined
messages (that is, through the act of messaging ), a message broker is an intermediary program
that translates messages from the formal messaging protocol of the publisher to the formal
messaging protocol of the receiver. Message broker programs are sometimes known
as middleware
In a publish/subscribe architecture for machine-to-machine (M2M) communication in the IOT,
the message broker decouples communication between devices that publish information and
other devices that subscribe to the information. This means that the publishing device, which
might be a sensor, does not need to know anything about subscribers; it only has to send
messages to the broker and then the broker manages and distributes the messages. Because
subscribers and publishers never communication directly with each other, there is less risk of a
publisher being directly attacked by a subscriber. The message broker, on the other hand, can become a target for attacks if not configured properly
2/ Using MQTT Explorer to connect to hiveMQ:
2.1. MQTT Explorer Introduction :
MQTT Explorer is currently a relatively active MQTT client desktop application .
2.2. HiveMQ Introduction :
HiveMQ is a world-class, enterprise-ready MQTT broker that provides fast, efficient, and reliable movement of data to and from connected IoT devices.
2.3. HiveMQ Usage :
step 1 :
step 2 :
step 3 :
step 4 :
2.4. MQTT Explorer Usage :
Commentaires
Enregistrer un commentaire