[Web-SIG] Could WSGI handle Asynchronous response?

Manlio Perillo manlio_perillo at libero.it
Mon Jul 28 23:40:00 CEST 2008


est ha scritto:
> I am writing a small 'comet'-like app using flup, something like
> this:
> 
> def myapp(environ, start_response):
>     start_response('200 OK', [('Content-Type', 'text/plain')])
>     return ['Flup works!\n']        <-------------Could this be part
> of response output? 

What do you mean by "part of response output"?

> Could I time.sleep() for a while then write other
> outputs?
> 

Not with flup.

> 
> if __name__ == '__main__':
>     from flup.server.fcgi import WSGIServer
>     WSGIServer(myapp, multiplexed=True, bindAddress=('0.0.0.0',
> 8888)).run()
> 
> 
> So is WSGI really synchronous? 

Not really.
Since you can return a generator, it's possible to support asynchronous 
programming, but the WSGI gateway must support it, as an example with 
Nginx mod_wsgi and some other implementations (search in the mailing 
list archive).

But this support has not been standardized.

> How can I handle asynchronous outputs
> with flup/WSGI ?


Regards  Manlio Perillo


More information about the Web-SIG mailing list