Womack server

Note

Womacks’s pip requirements files are split into a base file (requirements.txt) and a server file (requirements-server.txt). To run the server, you must install requirements-server.txt, which includes the extra requirements needed by the server. The make server command will do this, or pip install -r requirements-server.txt.

Running the server

In the simplest case – you want to use Womack to push events to clients, and don’t need to customize anything – you can just run the womack script. It accepts a number of command-line arguments.

-H, --host

The hostname or ip to serve on. Default: 0.0.0.0

-p, --port

The port to bind to. Default: 8111

--redis-host

The host where redis is running. Default: localhost

--redis-port

The port where redis is running. Default: 6379

--debug

Output debugging information to the console. Default: False

Customizing the server

See Womack namespace for information about customizing Womack’s handling of socketio namespaces. You can use a namespace to customize how messages are passed in your Womack-using system.

If besides (or instead of) that you want to customize how the server is run (for instance, to turn on the flash policy server, which is off by default, or to daemonize the server), you have to deal with a few phases of execution:

Configuration

You can use womack.server.parse_argv() to parse command line options – if you want to use the same ones – or parse them yourself and call womack.config.config.configure() to configure the Womack server.

Running

Womack is based on bottle and uses the standard socketio.SocketIOServer to serve the bottle application that is configured in womack.server:

def main(argv=None):
    """Parse command-line arguments and start the server"""
    opts = parse_argv(argv)
    if opts.debug:
        from dozer import Dozer

You can do the same thing, just pass womack.server.app to a SocketIOServer in the configuration of your choice, and run it.

Project Versions

Table Of Contents

Previous topic

Womack publisher

Next topic

Womack namespace

This Page