ginsfsm.protocols.wsgi

WSGI interface.

The wsgi/http server is inspired in Tornado and Waitress projects and using the best of both.

Are you tired of the tyranny of monolithic wsgi function? break the yoke. Send the http response when you want.

Gojs involved:

../../_images/wsgi-server.png

GObj GWsgiServer

WSGI server.

It uses ginsfsm.protocols.http.server.c_http_server.GHttpServer.

class ginsfsm.protocols.wsgi.server.c_wsgi_server.GWsgiServer[source]

WSGI Server gobj.

Configurable Parameters:
Name Type Default value Description
origins None None TODO:list of (host, port) tuples allowed to connect from
url_scheme str http default http value
max_request_body_size int 1073741824
inbuf_overflow int 524288
subscriber None None subcriber of all output-events.Default is None, i.e., the parent
application None None wsgi application
host str listening host
expose_tracebacks bool False expose tracebacks of uncaught exceptions
maximum_simultaneous_requests int 0 maximum simultaneous requests. Default: 0, without limit.
n_channels int 0 Server stats, number of channels opened
inactivity_timeout int 18000 Inactivity timeout in seconds.
responseless_timeout int 18000 ‘Without response’ timeout in seconds.
port int 0 listening port
identity str ginsfsm server identity (sent in Server: header)
max_request_header_size int 262144
Diagram:

Bottom Input-Events:

  • 'EV_HTTP_CHANNEL_OPENED': new http client.

    Event attributes:

    • channel: http channel.
  • 'EV_HTTP_CHANNEL_CLOSED': http client closed.

    Event attributes:

    • channel: http channel.
  • 'EV_HTTP_REQUEST': new http request.

    Event attributes:

    • channel: http channel.
    • request: http request.

See ginsfsm.protocols.http.server.c_http_clisrv.GHttpCliSrv.

start_up()[source]

Initialization zone.

Well, the __init__ method is used to build the FSM so I need another function to initialize the new gobj. Please, override me, and write here all the code you need to start up the machine: create your owns childs, etc. This function is called by create_gobj() after creating the gobj instance.