NAME

Plack::Handler::Net::Async::HTTP::Server - HTTP handler for Plack using Net::Async::HTTP::Server

SYNOPSIS

use Plack::Handler::Net::Async::HTTP::Server;

my $handler = Plack::Handler::Net::Async::HTTP::Server->new(
   listen => [ ":8080" ],
);

sub psgi_app { ... }

$handler->run( \&psgi_app );

DESCRIPTION

This module allows Plack to run a PSGI application as a standalone HTTP daemon under IO::Async, by using Net::Async::HTTP::Server.

plackup -s Net::Async::HTTP::Server --listen ":8080" application.psgi

This is internally implemented using Net::Async::HTTP::Server::PSGI; further information on environment etc.. is documented there.

If IO::Async::SSL is available, this handler supports accepting connections via https

plackup -s Net::Async::HTTP::Server --ssl ...

Or per-listen argument by appending :SSL, as

plackup -s Net::Async::HTTP::Server --listen ":8443:SSL" ...

Any other options whose names start ssl_ will be passed on to the SSL listen method.

METHODS

$handler = Plack::Handler::Net::Async::HTTP::Server->new( %args )

Returns a new instance of a Plack::Handler::Net::Async::HTTP::Server object. Takes the following named arguments:

listen => ARRAY of STRING

Reference to an array containing listen string specifications. Each string gives a port number and optional hostname, given as :port or host:port.

server_ready => CODE

Reference to code to invoke when the server is set up and listening, ready to accept connections. It is invoked with a HASH reference containing the following details:

$server_ready->( {
   host            => HOST,
   port            => SERVICE,
   server_software => NAME,
} )
socket => STRING

Gives a UNIX socket path to listen on, instead of a TCP socket.

queuesize => INT

Optional. If provided, sets the listen() queue size for creating listening sockets. If missing, a default of 10 is used.

$handler->run( $psgi_app )

Creates the HTTP-listening socket or sockets, and runs the given PSGI application for received requests.

SEE ALSO

AUTHOR

Paul Evans <leonerd@leonerd.org.uk>