diff --git a/lib/Plack/App/Net/Async/README.pod b/lib/Plack/App/Net/Async/README.pod new file mode 100644 index 0000000..53e3755 --- /dev/null +++ b/lib/Plack/App/Net/Async/README.pod @@ -0,0 +1,80 @@ +=encoding UTF-8 + +=head1 NAME + +C - serve WebSocket clients using C over PSGI + +=head1 SYNOPSIS + + use Plack::App::Net::Async::WebSocket; + + my $app = Plack::App::Net::Async::WebSocket->new( + on_client => sub { + my ( $client ) = @_; + $client->sent_frame( 'Hello' ); + }, + on_frame => sub { + my ( $client, $frame ) = @_; + $client->send_frame( $frame ); # echo + }, + on_closed => sub { + my ( $client ) = @_; + } + ); + +=head1 DESCRIPTION + +This subclass of L accepts WebSocket connections. When a +new connection arrives it will perform an initial handshake, and take control +over existing connection. + +=head1 PARAMETERS + +The following named parameters may be passed to C: + +=over 8 + +=item on_client => CODE + +A callback that is onvoke whenever a new connection has been handshaked. +This parameter is optional + +=item on_frame => CODE + +A CODE reference for when a frame is received + +=item on_close => CODE + +This parameter is optional + +=item on_error => CODE + +This parameter is optional + +=back + +=head1 METHODS + +=head2 $client->send_frame( @args ) + +Sends a frame to the peer containing the given string. The arguments +are passed to L's C method. + +=head1 SEE ALSO + +=over 8 + +=item * + +L - WebSocket server using C + +=item * + +L - HTTP handler for Plack using L + +=back + +=head1 AUTHOR + +Paweł Feruś +