Faced by this challenge Guy opted initially to continue using Apache2/PHP and created a socket communication protocol with the C++ program. But there were issues: “We saw that creating such a communication protocol was almost the same as having the queries arrive directly to the C++ program, bypassing the Apache2 server completely.”
The next option Guy and his team considered was to use a simple home-grown solution. They soon realised that given today’s abundance of platforms (iOS, Android, various web browsers, etc) implementing, maintaining and testing a new communication protocol would be an integration nightmare.
Guy decided to take his issue to the web and search for a solution. He tells us: “All our platforms have HTTP queries already built-in. We knew how simple this could be to integrate. So I set out to find a way to create an HTTP server in C++.”
It sounds like a simple solution, but it was quickly discovered that creating this was more complex, especially since HTTP data transfer has has many implementation specific idiosyncrasies that are different between the various clients.
“I wanted to check if there was an open source solution out there that we could test before buying it. To be honest, I wanted to see if I could rebuild it myself,” Guy details the beginning of looking at external solutions, “but as soon as I found Mongoose via Stack-Overflow, I immediately loved it!” Important to him and the RocketUncle team was simple code and easy implementation of the embedded web server. They wanted to be sure that, should any bugs ever arise, they could fix the code themselves in a matter of hours rather than waiting on a third party for a fix.
Working with the embedded web server Mongoose has turned out smoothly for RocketUncle. The implementation was quick and since then it simply runs. When using Apache2, there was always something to take care of: “Now, since we finished integrating the server into the C++ code with Mongoose, we haven’t had to touch or even think about the server. It just works. Other than the 2 hours it took to integrate, we haven’t had to even think about it. That leaves us with a lot more time to work on what’s actually important: the algorithm itself.”