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

 

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

This article is the third part of a series describing our development steps of a native MQL5 client for the MQTT protocol. In this part, we describe in detail how we are using Test-Driven Development to implement the Operational Behavior part of the CONNECT/CONNACK packet exchange. At the end of this step, our client MUST be able to behave appropriately when dealing with any of the possible server outcomes from a connection attempt.

When our client requests a connection with the server, it must inform the server about

  • some desired capabilities of the broker,
  • if it will need authentication with a username and password,
  • and if this connection is meant to be a new Session or it is resuming an earlier opened Session.

This is done by setting some bit flags at the start of the Variable Header, right after the Protocol Name and Protocol Version. These bit flags on the CONNECT packet are named Connect Flags.

Remember that bit flags are boolean values. They may be given different names or representations, but boolean values have only two possible values, usually true or false.


Author: Jocimar Lopes