MQTT Client-Broker Connection

mqtt-client-broker-connection
Spread the love

MQTT Client broker connection Establishment

The MQTT protocol is based on TCP/IP. Both client and broker must have a TCP/IP stack. The MQTT client-broker connection is always between a client and a broker. Clients never connect to each other directly.

The client will establish a TCP connection to the broker and if you have security enabled you can also use TLS.

So, you have an encrypted communication channel and as soon as this is established then the MQTT connect flow will start.

The client will send an MQTT to connect packet to the broker. The broker will then do authentication then the client will receive a connack packet.

Connect packet

Ours connect packet consists of many different properties.

Connack packet

A connack is a very simple packet it basically tells the client is it allowed to connect or is not allowed to connect. So, in case the authentication and authorization were successful then you will get a connect return code which tells you it was successful, and in case something bad happened or you were not allowed to connect to this broker you will get a return code with the actual reason code what went wrong and as soon as this connection is established and you have a valid connect back from a broker the client can start doing publishing or subscribing.

Also Read: Introduction of MQTT


Spread the love

Be the first to comment

Leave a Reply

Your email address will not be published.


*