Bandit (Bandit v0.4.1) View Source
Defines a Bandit server as part of a supervision tree. A typical child spec to start a Bandit server hosting a plug looks like:
{Bandit, plug: {MyApp.Plug, :arg_passed_to_plug_init}, options: [port: 4000]}
Three options are supported:
scheme
: One of:http
or:https
. If:https
is supported, you will need to specifycertfile
andkeyfile
in thetransport_options
subsection ofoptions
.plug
: The plug to handle connections. Can be specified asMyPlug
or{MyPlug, plug_opts}
read_timeout
: How long to wait for data from the client before timing out and closing the connection, specified in milliseconds. Defaults to 60_000options
: Options to pass toThousandIsland
. For an exhaustive list of options see theThousandIsland
documentation, however some common options are:port
: The port to bind to. Defaults to 4000num_acceptors
: The number of acceptor processes to run. This is mostly a performance tuning knob and can usually be left at the default value of 10transport_module
: The name of the module which provides basic socket functions. This overrides any value set forscheme
and is intended for cases where control over the socket at a fundamental level is needed.transport_options
: A keyword list of options to be passed into the transport socket's listen function
Link to this section Summary
Link to this section Types
Specs
A Plug definition
Link to this section Functions
Specs
child_spec([]) :: Supervisor.child_spec()