How to Hook up the HTTP Streaming Server APE (Ajax Push Engine) to a Computation-Expensive Server

馋奶兔 提交于 2019-12-24 10:36:25

问题


I've been studying the APE (Ajax Push Engine - http://www.ape-project.org/) for several weeks, and I have read all the documentation they have at the website.

The APE project claims "real-time data streaming", but I just cannot find a good example for that. I'm kind of frustrated with their documentation.

The possible wikipage I read at their website: http://www.ape-project.org/wiki/index.php/Tutorial:How_to_write_an_application_with_APE

But again, it just has some concepts, not detailed info.

After doing some Google search, I started feeling more frustrated. No valuable tutorials or examples for my purpose.

So I'm posting this here.

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:

  1. Use HTTP protocol (no RTMP);
  2. The client streams the audio data to the server;
  3. The server receives the audio data, processes it and sends the result back to the cient WHILE receiving the audio data from the client;
  4. The processing of the audio data is done in a C/C++ library;
  5. The server is also be able to stream several-second audio data to the client, and the client can play the audio WHILE receiving the audio data from the server;
  6. 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;

My questions are:

  1. What APE examples and tutorials should I read to facilitate my needs?
  2. Where can I find a good example using APE HTTP Streaming?
  3. How can I create a very simple HTTP streaming example (server streams)?
  4. How can I hook up my computation-expensive C/C++ lib at the server side?
  5. How can I maintain the state of each client connection/session at the server side?

If anyone know any idea of my requirements or questions, please let me know.

Thanks.

Peter


回答1:


APE is meant for exchanging JSON data - not streamed data. So, you must find a solution where your standard web server (running your lib) receives and parses the data. What you can do with APE then is so called "inline push". This means, sending data from the backend server to the APE server so it can forward the data to the clients.

In your case, I would regularily have the parsing lib send a status update to the APE server so it can be distributed to the client.

Regarding your questions:

  1. http://www.ape-project.org/wiki/index.php/Libape-controller
  2. Nowhere - it is not meant for that
  3. With anothother server side programming language of your choice
  4. Obviously, depends on your Apache/Nginx and server language
  5. Thats something APE can and will do - if you do the required programming on the server side. You already commented on my blog, so you might have seen http://www.xosofox.de/2010/10/ape-user-handling/ - this should give you some hints.

tl;dr

  • Use another server as backend for the lib
  • Have the lib server send short status updates via inline push to APE so APE will push it to the client


来源:https://stackoverflow.com/questions/8719755/how-to-hook-up-the-http-streaming-server-ape-ajax-push-engine-to-a-computation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!