What is the MQTT protocol?

Asked

Viewed 310 times

6

These days I’ve heard of a communication protocol called MQTT.

For me it sounded like news and I would like to ask some questions:

  • What is the MQTT?

  • He uses TCP?

  • It has some difference in relation to HTTP?

  • 2

    Are you talking about this https://mqtt.org/ ? If it is Iot (internet of things) ... I believe it has nothing to do with HTTP. In short, it is a "protocol of its own" that runs on top of TCP, but I’m not an expert on the subject, maybe it’s not an on-topic question.

  • That same @Guilhermenascimento.

4 answers

7


MQ Telemetry Transport (MQTT)

MQT is currently the standard protocol for the internet of things. This becomes clear since it is designed for carrying and signing extremely light messages and with little network bandwidth usage. It carries your messages over TCP and uses SSL/TLS for security.

Hypertext Transfer Protocol (HTTP)

HTTP is used as a World Wide Web formatting base. It is the protocol responsible for the action that a server must perform when sending information over the network. I only gave a brief introduction to HTTP, as it is not the main point of the question.

MQTT and HTTP differences


The MQTT is data-centric, with this it is simpler and has more lightness because your messages are in binary format and its header has at most two bits. It follows the publication/signature model, which makes the message arrive on the server and not the "lock" waiting for the answer, being able to make several submissions.

According to measurements on 3G networks, MQTT throughput is 93 times faster than HTTP.

MQTT has very short specifications. Virtually the only types used are CONNECT, PUBLISH, SUBSCRIBE, UNSUBSCRIBE and DISCONNECT.


While HTTP is document-centric, its messages follow the ASCII standard and the header has 8bytes. Follow the request/response model, for this reason you have to wait for the server’s response when making a request can lock the system.

It does not offer security standards like SSL/TLS, but it has already been created to be a security standard.

Curiosity: MQTT works on port 1883 while HTTP on 80 or 8080.

Completion

Both HTTP and MQTT are valid to use, but MQTT has already been created for simpler transmissions as internet of things, for this reason it is recommended to use for this purpose.

4

  • The MQTT- Message Queue Telemetry Transport is a Protocol of TCP/IP stack-based communication, being extremely useful for development of communication projects between Machine-Machine (M2M) its concept of transmission is of the type Publication/Signature.

  • Developed by Andy Stanford-Clark of IBM and Arlen Nipper in 1999, its original application consisted of monitoring sensors in pipelines of oil through satellites, the MQTT was released to the public from free form in the year 2010. On October 29, 2014 the protocol became standard OASIS- Organization for the Advancement of Structured Information Standards. Currently the protocol is in version 5.0 (3 April 2019), with improvements in error reporting, shared signatures, and message, message expiration, session expiration, alias of topic, delayed delivery function and discovery of permitted functions.

  • MQTT has many qualities and advantages compared to others protocols such as HTTP, proving to be ideal for communication between remote devices because of their higher quality of service security level, ease of implementation, low allocation of band, libraries compatible with various languages of programming, its concept of distribution, service levels of agreement with relevance of the message, delivery guarantees, changes in sending data, where a data can be sent to none, one, or several clients, among other qualities that make it ideal for iot projects.

  • Publishing and receiving data is done through a server named Broker. A client in the role of Pulicador or Publisher, who is the person who conveys the message, writes a destination topic of the message and your Payload (message content), that message then is transmitted to the Broker who will be responsible for managing and forwarding it subscribed or subscriber previously subscribed to the topic. From the topic way, when a customer wants to become a Subscriber in a given topic, it forwards a request message to the Broker, who will make this interconnection between client and topic.

    We can simplify into:

    Publisher/ Publisher: Who sends data to a topic, sender.

    Subscribed/ Subscriber: Person who is subscribed to the topic and receives the data, receiver.

    Broker: Intermediary of communication between Publisher and Subscriber, responsible for receiving, queuing and sending the messages.

    Payload: Content of the message sent. Client/Client: Element able to interact with Broker, be it to send, receive or both.

    Message: Data packet exchanged between Customers and Broker.

    Topical: Address to which data will be forwarded.

    Unsubscribe: Stop signing a thread.

    It is worth mentioning that a Customer can act both as Publisher and Subscriber.

inserir a descrição da imagem aqui

0

You have three questions, so I have three points:

  • MQTT is a protocol used in Iot to send messages with three types of characteristics: 1) Messages are asynchronous 2) Messages are sent as "Publisher and Subscriber" 3) Messages are small.
  • MQTT sends its messages via TCP / IP protocol.
  • HTTP also works on TCP / IP, but the differences are between the features: HTTP 1) is synchronous protocol 2) sends messages one to a 3) is a major protocol in part of the titles and its own protocol.

MQTT is optimized for data transfer when a limited number of resources are available, both in data transfer and in device capacity. The data transmission method you use also does not limit the number of senders or recipients.

More Information:

[1] https://pt.wikipedia.org/wiki/MQTT

[2] https://developer.ibm.com/technologies/messaging/articles/iot-mqtt-why-good-for-iot/ (in English)

-1

  1. MQTT is a lightweight messaging protocol for sensors and small mobile devices optimized for networks.

  2. It uses TCP/IP

  3. The biggest difference between them is the size of the payload. In HTTP the payload is bigger, which makes it impossible to use in low quality connections. In addition MQTT has greater security, has more service levels, is less complex and allows 1-to-N communication compared to HTTP which is also a protocol used in the universe of Internet of Things.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.