Discussion of article "Developing an MQTT client for MetaTrader 5: a TDD approach"

 

New article Developing an MQTT client for MetaTrader 5: a TDD approach has been published:

This article reports the first attempts in the development of a native MQTT client for MQL5.MQTT is a Client Server publish/subscribe messaging transport protocol. It is lightweight, open, simple, and designed to be easy to implement. These characteristics make it ideal for use in many situations.

Despite the fact that it was designed to be robust, fast, and cheap due to tech stack limitations and expensive network costs, it was required to provide quality of service data delivery with continuous session awareness, which allows it to cope with unreliable or even intermittent internet connections.

As a binary protocol, MQTT is very efficient in terms of memory and processing requirements. It is even curious that the smallest MQTT packet has only two bytes!


Since it is based on a publish/subscribe model (pub/sub), instead of a request/response, MQTT is bi-directional. What is to say, once a client/server connection is established, data can flow from client to server and from server to client at any time, without the need of a previous request, as is the case with HTTP WebRequest. Once data arrives, the server immediately forwards it to the recipients. This feature is a cornerstone of real-time data exchange since it allows for the minimum latency between endpoints. Some vendors advertise latency in the order of milliseconds.


Author: Jocimar Lopes

 

Hi Jocimar,

Thank you for this amazing tutorial. I have a trouble running part 2 and if possible  I would like your assistance . I am running on Windows 10 and without WSL. 
I have installed mosquitto and start the service by typing (from the installation folder):

net start mosquitto

and the service successfully starts in the default port of 1883. Next, in order to find the broker_ip I run:

ipconfig/all

and get the respective IP address, which later is used to redirect network traffic from 80 or 443 (I have tried both) to the broker_ip found with the above command. The redirection is happening by typing the following:

netsh interface portproxy add v4tov4 listenport=443 listenaddress="what should be put here?" connectport=1883 connectaddress=" my broker_ip"

And then I complete in the script with the port and the broker_ip and execute it. I get 5272 error code, which means that it "Failed to connect to remote host". Of course, I have included the broker_ip to the Expert options tab.

Is something that I am missing in the whole process?

Thanks in advance,
Dr.Pip

 
DrPip83 #:

Hi Jocimar,

Thank you for this amazing tutorial. I have a trouble running part 2 and if possible  I would like your assistance . I am running on Windows 10 and without WSL. 
I have installed mosquitto and start the service by typing (from the installation folder):

and the service successfully starts in the default port of 1883. Next, in order to find the broker_ip I run:

and get the respective IP address, which later is used to redirect network traffic from 80 or 443 (I have tried both) to the broker_ip found with the above command. The redirection is happening by typing the following:

And then I complete in the script with the port and the broker_ip and execute it. I get 5272 error code, which means that it "Failed to connect to remote host". Of course, I have included the broker_ip to the Expert options tab.

Is something that I am missing in the whole process?

Thanks in advance,
Dr.Pip

Hi, DrPip83

I noted that you have asked this questions fourty days ago. I didn't see it before. Right now I received a message from an admin about your question. I'm sorry for this long delay. 

To the point: what script are you using to connect? Could you please share it? In part 2 we have **no functional connection** with the broker. Untill that point we had only packet building stubs, the first classes that we were prototyping. We were experimenting with connections "out-of-band", let's say, using only internal scratch scripts not shared on the attachments. Only now we are implementing real connections in the so-called Operational Behavior of the protocol (or the Actions, as per the Standard).

So, could you please share your script? Maybe I can help with it or share with you the scripts we were using for this purpose.