IOMux::HTTP::Service
is a IOMux::HTTP
is a IOMux::Net::TCP
is a IOMux::Handler::Read
is a IOMux::Handler
IOMux::Net::TCP also extends IOMux::Handler::Write
is a IOMux::Handler::Write
is a IOMux::Handler

The STATUS code is used in the response, preferrable use the constants from HTTP::Status.

The HEADER is an ARRAY of header line pairs to be used in the answer or an HTTP::Headers object.

You can use a scalar CONTENT, which will be used as response body. In case the CONTENT parameter is a CODE reference, that CODE will be called until undef is returned. The result of every call will become a chunk in a chunked transfer encoded response.

The server is a daemon: a process which always runs. There are many deamon implementations available for Perl. See the examples/ directory for an example which uses Any::Daemon. The examples below should seamlessly fit in the run_multiplexer() function shown there.

The initiation looks much like that of a client. use HTTP::Status 'HTTP_OK';

# You may also choose IOMux::Select or other
# multiplex instances (to be developed)
use IOMux::Poll;
my $mux = IOMux::Poll->new;
my $server = "localhost:8081";
my $client = IOMux::HTTP::Server->new
( LocalAddr => $server
, handler => \&incoming_first
);
$mux->add($client);
# You may initiate multiple clients and start many different steps
# until you start the loop.
$mux->loop;
# The loop is left when all connections have closed
exit 0;
# Now here comes the implementation as shown in the examples below.