Asynchronous COMET query with Tornado and Prototype

后端 未结 4 680
说谎
说谎 2021-01-30 15:10

I\'m trying to write simple web application using Tornado and JS Prototype library. So, the client can execute long running job on server. I wish, that this job runs Asynchronou

4条回答
  •  半阙折子戏
    2021-01-30 15:46

    I've converted Tornado's chat example to run on gevent. Take a look at the live demo here and the explanation and source code here.

    It uses lightweight user-level threads (greenlets) and is comparable in speed/memory use with Tornado. However, the code is straightforward, you can call sleep() and urlopen() in your handlers without blocking the whole process and you can spawn long running jobs that do the same. Under the hood the application is asynchronous, powered by an event loop written in C (libevent).

    You can read the introduction here.

提交回复
热议问题