Discussing the article: "Developing an MQTT client for Metatrader 5: a TDD approach — Part 4"


Check out the new article: Developing an MQTT client for Metatrader 5: a TDD approach — Part 4.

This article is the fourth part of a series describing our development steps of a native MQL5 client for the MQTT protocol. In this part, we describe what MQTT v5.0 Properties are, their semantics, how we are reading some of them, and provide a brief example of how Properties can be used to extend the protocol.

Properties are part of the ‘extensibility mechanisms’ that were added in MQTT v5.0. They did not exist in the previous v3.1.1, which was the latest version before this major upgrade. They are ubiquitous in MQTT v5.0. But, what are MQTT properties? Properties of what, exactly?

Properties of the Application Message is the answer. In OASIS Standard’s terminology, the Application Message is

“The data carried by the MQTT protocol across the network for the application. When an Application Message is transported by MQTT it contains payload data, a Quality of Service (QoS), a collection of Properties, and a Topic Name.” (emphasis is ours)

Please, take a look at the yellow rectangle representing the ‘Payload data’ in Figure 1, below. There is an important terminology distinction that we want to bring to your attention here.

MQTT 5.0 Application Message Abstract Diagram

Fig.01 - MQTT 5.0 Application Message Abstract Diagram

In the context of a message-sharing protocol, when we see the word ‘message’ we are used to thinking about the user message, frequently a text message. More often than not, we do not think about the message as the application as a whole. 

But here, the message sent by the users via MQTT is part of the Payload data and Properties are part of the protocol abstract model named Application Message. Thus, when we send a user message via MQTT we can have not only properties related to that ‘user message’, but we can also have properties related to the Application Message as a whole: properties for the connection, properties for publishing, properties for subscribing and usubscribing to topics, properties for the authentication, and so on.

Besides that, there are the Will Properties attached to the Will Message.

"The Will Message consists of the Will Properties, Will Topic, and Will Payload fields in the CONNECT Payload. "

This terminology may be a bit confusing when one starts implementing the protocol, but we will do our best to make it as clear as possible.

Author: Jocimar Lopes

Yousuf Mesalm  
thanks for your great effort 
waiting for part 5