How do I save a C ++ server application using the modern web client interface?

I am developing an industrial client / server application (C ++) with strong real-time requirements. I feel like it's time to change the look of the client interface that is designed in MFC, but I'm wondering which one would be the right choice. If I go for a web client, is there a way to communicate between C ++ and javascript other than AJAX ↔ Web Service ↔ COM? Web client requirements: fast status update, user commands, tables

+1


source to share


4 answers


My team should have made the same decision a few months ago ...

The cool thing about making this a web app would be very easy to change later. Even the user of the interface (with a little know-how) can change it according to his needs. Custom software becomes much simpler.

We went with a web interface and ajax seems to be fine, it was quite responsive.



On the other hand, depending on how strong your real-time requirements are, this can be difficult. We had a problem displaying live data through the browser, we ended up with a firefox plugin to draw the plot. If you are just trying to display live text data this shouldn't be a problem.

Run some tests for your specific application and see what it looks like.

Something else to consider, if you have a web page that is an interface to your server, keep in mind that you will need to specify a way to update one client when another changes the server state if you plan to allow multiple interfaces to your server.

+2


source


Write an HTTP server on your server to handle AJAX feedback. If you don't want to serve files, create your server on a non-standard port (like 8081) and use a regular web server to actually deliver the web page. Now your AJAX server is communicating with the server on port Bizarro instead of port 80.

But it's not that hard to write the file server part, either. If you do this, you can also generate web pages on the fly with pre-populated data if you want.

Google Desktop Search is doing it now. When I browse my desktop for "foobar" the url opens:



http://127.0.0.1:4664/search?q=foobar&flags=68&num=10

In this case, 4664 is the Bizarro port. (GoogleDesktop serves all the data here, it uses the Bizarro port to avoid conflicts with any web server I might be running.)

+1


source


I usually build my apps in 2x:

  • Have real heavy duty CLI apps. The protocol used is usually text-only, consisting of requests and responses.
  • Wrap the GUI as another process that talks to the CLI connector.

The web interface is just another graphical interface for porting. Also, it's much easier to wrap a REST / JSON based API in a CLI (just automatically translate messages).

Debugging is pretty straightforward as well, as you can simply dump requests between two items and reproduce errors more easily.

+1


source


You might want to consider where your data lives. If your application supports an underlying database, you can write a web application that leaves your C ++ code tactfully - the web application will be independent and offer pages to web users and talk directly to the database. In this case, you have as many options, and much more as you indicated.

0


source







All Articles