Handling XMLHttpRequest to call external application

Posted by Ian on Stack Overflow See other posts from Stack Overflow or by Ian
Published on 2010-05-25T01:25:01Z Indexed on 2010/05/25 1:31 UTC
Read the original article Hit count: 335

Filed under:
|
|
|

I need a simple way to use XMLHttpRequest as a way for a web client to access applications in an embedded device. I'm getting confused trying to figure out how to make something thin and light that handles the XMLHttpRequests coming to the web server and can translate those to application calls.

The situation:

  • The web client using Ajax (ExtJS specifically) needs to send and receive asynchronously to an existing embedded application. This isn't just to have a thick client/thin server, the client needs to run background checking on the application status.
  • The application can expose a socket interface, with a known set of commands, events, and configuration values. Configuration could probably be transmitted as XML since it comes from a SQLite database.
  • In between the client and app is a lighttpd web server running something that somehow handles the translation. This something is the problem.

What I think I want:

  • Lighttpd can use FastCGI to route all XMLHttpRequest to an external process. This process will understand HTML/XML, and translate between that and the application's language. It will have custom logic to simulate pushing notifications to the client (receive XMLHttpRequest, don't respond until the next notification is available).
  • C/C++. I'd really like to avoid installing Java/PHP/Perl on an embedded device. So I'll need more low level understanding.

How do I do this?

  • Are there good C++ libraries for interpreting the CGI headers and HTML so that I don't have to do any syntax processing, I can just deal with the request/response contents?
  • Are there any good references to exactly what goes on, server side, when handling the XMLHttpRequest and CGI interfaces?
  • Is there any package that does most of this job already, or will I have to build the non-HTTP/CGI stuff from scratch?

Thanks for any help! I am really having trouble learning about the server side of these technologies.

© Stack Overflow or respective owner

Related posts about AJAX

Related posts about embedded