title: How to Hook up the HTTP Streaming Server APE (Ajax Push Engine) to a Computation-Expensive Server
body: <p>I've been studying the APE (Ajax Push Engine - <a href="http://www.ape-project.org/" rel="nofollow">http://www.ape-project.org/</a>) for several weeks, and I have read all the documentation they have at the website.</p>
  
  <p>The APE project claims "<strong>real-time data streaming</strong>", but I just cannot find a good example for that.  I'm kind of frustrated with their documentation.</p>
  
  <p>The possible wikipage I read at their website:
  <a href="http://www.ape-project.org/wiki/index.php/Tutorial:How_to_write_an_application_with_APE" rel="nofollow">http://www.ape-project.org/wiki/index.php/Tutorial:How_to_write_an_application_with_APE</a></p>
  
  <p>But again, it just has some concepts, not detailed info.</p>
  
  <p>After doing some Google search, I started feeling more frustrated.  <strong>No valuable tutorials or examples for my purpose</strong>.</p>
  
  <p>So I'm posting this here.</p>
  
  <p>Basically, what I've been wanting to do is, an HTTP streaming server (with very computation expensive) can still scale reasonably well (100 or 200 clients).  Requirements:</p>
  
  <blockquote>
    <ol>
    <li>Use HTTP protocol (no RTMP);</li>
    <li>The client streams the audio data to the server;</li>
    <li>The server receives the audio data, processes it and sends the result back to the cient <strong>WHILE receiving</strong> the audio data from the
    client;</li>
    <li>The processing of the audio data is done in a <strong>C/C++ library</strong>;</li>
    <li>The server is also be able to <strong>stream</strong> several-second audio data to the client, and the client can play the audio <strong>WHILE receiving</strong> the
    audio data from the server;</li>
    <li>A long-lived connection/session should be made between a client and the server, and the disconnection (TimeOut or UserDisconnect)
    should be detected by the server;</li>
    </ol>
  </blockquote>
  
  <p>My questions are:</p>
  
  <blockquote>
    <ol>
    <li>What APE examples and tutorials should I read to facilitate my needs?</li>
    <li>Where can I find a good example using APE HTTP Streaming?</li>
    <li>How can I create a very simple <strong>HTTP streaming example (server streams)</strong>?</li>
    <li>How can I <strong>hook up my computation-expensive C/C++ lib at the server side</strong>?</li>
    <li>How can I <strong>maintain the state of each client connection/session</strong> at the server side?</li>
    </ol>
  </blockquote>
  
  <p>If anyone know any idea of my requirements or questions, please let me know.</p>
  
  <p>Thanks.</p>
  
  <p>Peter</p>