Provided by: libprotocol-websocket-perl_0.26-3_all bug

NAME

       Protocol::WebSocket::Client - WebSocket client

SYNOPSIS

           my $sock = ...get non-blocking socket...;

           my $client = Protocol::WebSocket->new(url => 'ws://localhost:3000');
           $client->on(
               write => sub {
                   my $client = shift;
                   my ($buf) = @_;

                   syswrite $sock, $buf;
               }
           );
           $client->on(
               read => sub {
                   my $client = shift;
                   my ($buf) = @_;

                   ...do smth with read data...
               }
           );

           # Sends a correct handshake header
           $client->connect;

           # Register on connect handler
           $client->on(
               connect => sub {
                   $client->write('hi there');
               }
           );

           # Parses incoming data and on every frame calls on_read
           $client->read(...data from socket...);

           # Sends correct close header
           $client->disconnect;

DESCRIPTION

       Protocol::WebSocket::Client is a convenient class for writing a WebSocket client.