As an end-to-end demonstration project, which we will develop throughout this chapter, we will take a simple, but at the same time quite technologically advanced product: a client-server copy trade system. The client part will be MQL programs that communicate with the central part using the sockets technology. Considering that MQL5 allows you to work only with client sockets, you will need to choose an alternative platform for the socket server (more on that below). Thus, the project will require the symbiosis of several different technologies and the use of many sections of the MQL5 API that we have already studied, including application codes developed on their basis.
Thanks to the socket-based client-server architecture, the system can be used in different scenarios:
In all cases, client programs will act in 2 roles: a publisher (publisher, sender) and a subscriber (recipient) of data.
We will not invent our own network protocol but will use the existing and popular WebSocket standard. Their client implementation is built into all browsers, and we will need to repeat it (with a greater or lesser degree of completeness) in MQL5. Of course, WebSocket support is also available for most popular web servers. Therefore, in any case, our developments can not only be adapted to other servers (if someone else suits) but also integrated with well-known sites that provide similar web services. Here the whole point is to strictly follow the specification of their API, built on top of WebSockets.
When developing software systems that are more complex than one standalone program, it is important to draw up an action plan and, possibly, even design a technical project, including the structure of modules, their interaction, and the sequence of coding.
So our plan includes:
But before we start implementing the plan, we need to install a web server.