This wsgi server is a single threaded, single process server that interleaves the iterations of the wsgi apps - I could add a threadpool for blocking apps in the future.
If you don’t return iterators from apps and return lists you’ll get, at most, the performance of a server that processes requests sequentialy.
On the other hand this server has coroutine extensions that suppose to support use of middleware in your application.
Example app with coroutine extensions:
def wait_app(environ, start_response):
start_response('200 OK', [('Content-type','text/html')])
yield "I'm waiting for some signal"
yield environ['cogen'].core.events.WaitForSignal("abc", timeout=1)
if isinstance(environ['cogen'].result, Exception):
yield "Your time is up !"
else:
yield "Someone signaled me: %s" % environ['cogen'].result
HTTP handling code taken from the CherryPy WSGI server.
Bases: object
An HTTP server for WSGI.
Option | Description |
---|---|
bind_addr | The interface on which to listen for connections. For TCP sockets, a (host, port) tuple. Host values may be any IPv4 or IPv6 address, or any valid hostname. The string ‘localhost’ is a synonym for ‘127.0.0.1’ (or ‘::1’, if your hosts file prefers IPv6). The string ‘0.0.0.0’ is a special IPv4 entry meaning “any active interface” (INADDR_ANY), and ‘::’ is the similar IN6ADDR_ANY for IPv6. The empty string or None are not allowed. For UNIX sockets, supply the filename as a string. |
wsgi_app | the WSGI ‘application callable’; multiple WSGI applications may be passed as (path_prefix, app) pairs. |
server_name | the string to set for WSGI’s SERVER_NAME environ entry. Defaults to socket.gethostname(). |
request_queue_size | the ‘backlog’ argument to socket.listen(); specifies the maximum number of queued connections (default 5). |
protocol | the version string to write in the Status-Line of all HTTP responses. For example, “HTTP/1.1” (the default). This also limits the supported features used in the response. |
The interface on which to listen for connections.
For TCP sockets, a (host, port) tuple. Host values may be any IPv4 or IPv6 address, or any valid hostname. The string ‘localhost’ is a synonym for ‘127.0.0.1’ (or ‘::1’, if your hosts file prefers IPv6). The string ‘0.0.0.0’ is a special IPv4 entry meaning “any active interface” (INADDR_ANY), and ‘::’ is the similar IN6ADDR_ANY for IPv6. The empty string or None are not allowed.
For UNIX sockets, supply the filename as a string.
Bases: object
Server factory for paste.