4.9.1 Sample Simple Session Server
Description: Sample Simple Session Server
Keywords: albatross

##
4.9.1 Sample Simple Session Server

The `albatross.simpleserver` module is a sample session server. It can either be used stand-alone, or imported into other Python scripts.

The session server uses TCP sockets to communicate with the application mixin, by default listening on port 34343. The server port can be changed by using the `-p` or `-port=` command line argument. Internally the server uses a select loop to allow connections from multiple applications simultaneously.

Note that the daemon does not need to run as `root`, provided it listens on a port above 1024. If possible, you should run it under a user ID not shared by any other processes (and not `nobody`). You should also ensure that only authorised clients can connect to your session server, as the protocol provides no authentication or authorisation mechanisms.

Application constructor arguments which are relevant to the session server are:

- session_appid

  This is used to identify the application with the session server. It is also used as the session id in the cookie sent to the browser.

- session_server`= 'localhost'`

  If you decide to run the session server on a different machine to the application you must pass the host name of the session server in this argument.

- server_port`= 34343`

  If you decide to run the session server on a different port you must pass the port number in this argument.

- session_age`= 1800`

  This argument defines the amount of time in seconds for which idle sessions will kept in the server.