AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

Changes  view on Meta::CPAN

    (gh#25 thanks Toshio Ito)

0.34      2016-07-26 14:04:52 -0400
  - Documentation improvements
  - Production version functionally identical to the 0.33_01 release.

0.33_01   2016-07-25 22:48:06 -0400
  - Added optional code and reason arguments to $connection->close (gh#23 thanks José Joaquín Atria)

0.33      2016-04-25 12:12:12 -0400
  - t/ae_ssl.t may now be skipped by setting ANYEVENT_WEBSOCKET_TEST_SKIP_SSL

0.32      2015-12-17 14:02:36 -0500
  - URI 1.53 or better has been required for a while (if not since 0.01)
    This is now reflected in the module metadata.
    Thanks to Fabien Wernli (faxm0dem) for the report.

0.31      2015-10-11 06:21:29 -0400
  - Removed deprecated methods for AnyEvent::WebSocket::Connection class:
    on_each_message
    on_next_message

Changes  view on Meta::CPAN

  - Require Moo 2.0, as older versions inadvertently turn on
    fatal warnings

0.29      2015-01-17 10:03:16 -0500
  - document when deprecated methods will be removed.

0.28      2014-12-08 12:43:53 -0500
  - make confusing documentation less confusing.

0.27      2014-08-20 03:54:14 -0400
  - disable t/mojo_ssl.t since it is unreliable and we test the 
    same features with t/ae_ssl.t now.

0.26      2014-08-19 10:59:26 -0400
  - if Crypt::Random::Source is already installed, require at least
    version 0.08 to avoid Class::MOP deprecation warnings

0.25      2014-08-11 14:35:11 -0400
  - fix broken link in documentation

0.24      2014-08-11 07:29:49 -0400
  - documentation
    (add a FAQ about AnyEvent that I keep getting)
  - testing ssl
    (without Mojo)

0.23      2014-08-04 12:41:07 -0400
  - documentation improvements
  - use AE:: instead of AnyEvent-> for performance

0.22      2014-06-19 15:33:56 -0400
  - Mojo 5.x compat (testing only)

0.21      2014-04-08 12:52:51 -0400

Changes  view on Meta::CPAN

  - documentation

0.18      2013-10-21 14:55:47 -0400
  - documentation

0.17      2013-10-16 10:58:41 -0400
  - public API for creating Connection instance (thanks Toshio Ito gh#10)
  - bug fix messages sent by server immediately after connect may have been lost (thanks Toshio Ito gh#12)

0.16      2013-10-15 13:05:36 -0400
  - skip ssl test if you have a bad combination of Mojolicious and Net::SSLeay (gh#11)

0.15      2013-10-10 13:20:00 -0400
  - actually require moo 1.001000, and use scalar default value
    that feature should have been there to begin with.

0.14      2013-10-10 13:09:42 -0400
  - fix older Moo compat

0.12      2013-10-10 07:07:42 -0400
  - deprecate on_next_message, on_each_message and on_finish

LICENSE  view on Meta::CPAN


Source code for a work means the preferred form of the work for making
modifications to it.  For an executable file, complete source code means
all the source code for all modules it contains; but, as a special
exception, it need not include source code for modules which are standard
libraries that accompany the operating system on which the executable
file runs, or for standard header files or definitions files that
accompany that operating system.

  4. You may not copy, modify, sublicense, distribute or transfer the
Program except as expressly provided under this General Public License.
Any attempt otherwise to copy, modify, sublicense, distribute or transfer
the Program is void, and will automatically terminate your rights to use
the Program under this License.  However, parties who have received
copies, or rights to use copies, from you under this General Public
License will not have their licenses terminated so long as such parties
remain in full compliance.

  5. By copying, distributing or modifying the Program (or any work based
on the Program) you indicate your acceptance of this license to do so,
and all its terms and conditions.

MANIFEST  view on Meta::CPAN

lib/AnyEvent/WebSocket/Message.pm
maint/cip-before-install
maint/proxy.pl
perlcriticrc
t/00_diag.t
t/01_use.t
t/anyevent_websocket_client.t
t/anyevent_websocket_client__proxy.t
t/anyevent_websocket_client__scope.t
t/anyevent_websocket_client__server_initial_data_shutdown.t
t/anyevent_websocket_client__ssl.t
t/anyevent_websocket_connection.t
t/anyevent_websocket_connection__counter_shutdown.t
t/anyevent_websocket_connection__destroy_in_callbacks.t
t/anyevent_websocket_connection__finish_callback.t
t/anyevent_websocket_connection__payload_size.t
t/anyevent_websocket_message.t
t/lib/Test2/Plugin/AnyEvent/Timeout.pm
t/lib/Test2/Plugin/EV.pm
t/lib/Test2/Require/NotWindows.pm
t/lib/Test2/Require/SSL.pm

README  view on Meta::CPAN

    version when using this module. The older version of the API has since
    been deprecated and removed.

ATTRIBUTES

 timeout

    Timeout for the initial connection to the web server. The default is
    30.

 ssl_no_verify

    If set to true, then secure WebSockets (those that use SSL/TLS) will
    not be verified. The default is false.

 ssl_ca_file

    Provide your own CA certificates file instead of using the system
    default for SSL/TLS verification.

 protocol_version

    The protocol version. See Protocol::WebSocket for the list of supported
    WebSocket protocol versions.

 subprotocol

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

# ABSTRACT: WebSocket client for AnyEvent
our $VERSION = '0.55'; # VERSION


has timeout => (
  is      => 'ro',
  default => sub { 30 },
);


has ssl_no_verify => (
  is => 'ro',
);


has ssl_ca_file => (
  is => 'ro',
);


has protocol_version => (
  is => 'ro',
);


has subprotocol => (

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

    my %subprotocol;
    if($self->subprotocol)
    {
      %subprotocol = map { $_ => 1 } @{ $self->subprotocol };
      $handshake->req->subprotocol(join(',', @{ $self->subprotocol }));
    }

    my $hdl = AnyEvent::Handle->new(
                                                      fh       => $fh,
      provided $uri->secure,                          tls      => 'connect',
      provided $uri->secure && !$self->ssl_no_verify, peername => $uri->host,
      provided $uri->secure && !$self->ssl_no_verify, tls_ctx  => {
                                                              verify => 1,
                                                              verify_peername => "https",
                                                        maybe ca_file => $self->ssl_ca_file,
                                                      },
                                                      on_error => sub {
                                                        my ($hdl, $fatal, $msg) = @_;
                                                        if($fatal)
                                                        { $done->croak("connect error: " . $msg) }
                                                        else
                                                        { warn $msg }
                                                      },
    );

lib/AnyEvent/WebSocket/Client.pm  view on Meta::CPAN

when using this module.  The older version of the API has since been
deprecated and removed.

=head1 ATTRIBUTES

=head2 timeout

Timeout for the initial connection to the web server.  The default
is 30.

=head2 ssl_no_verify

If set to true, then secure WebSockets (those that use SSL/TLS) will
not be verified.  The default is false.

=head2 ssl_ca_file

Provide your own CA certificates file instead of using the system default for
SSL/TLS verification.

=head2 protocol_version

The protocol version.  See L<Protocol::WebSocket> for the list of supported
WebSocket protocol versions.

=head2 subprotocol

t/anyevent_websocket_client__server_initial_data_shutdown.t  view on Meta::CPAN

      },
    );

    if($test_case->{tls})
    {
      $server_args{tls} = AnyEvent::TLS->new(cert => $test_case->{tls_cert});
    }

    my $url = start_server(%server_args);
    my $cv_finish = AnyEvent->condvar;
    my $conn = eval { AnyEvent::WebSocket::Client->new(ssl_no_verify => 1)->connect($url)->recv };
    if($@)
    {
      my $error = $@;
      die $error;
    }
    my @received_messages = ();
    $conn->on(each_message => sub {
      my ($conn, $message) = @_;
      push(@received_messages, $message->body);
    });

t/anyevent_websocket_client__ssl.t  view on Meta::CPAN

        $opt->{hdl}->push_write($opt->{frame}->new(type => 'close')->to_bytes);
        $opt->{hdl}->push_shutdown;
      }
    };
  },
);

$uri->path('/count/10');
note $uri;

my $connection = eval { AnyEvent::WebSocket::Client->new( ssl_no_verify => 1 )->connect($uri)->recv };

if(my $error = $@)
{
  die $error;
}

isa_ok $connection, 'AnyEvent::WebSocket::Connection';

my $done = AnyEvent->condvar;

t/lib/Test2/Tools/WebSocket/Mojo.pm  view on Meta::CPAN

use base qw( Exporter );
use Mojo::Server::Daemon;
use Test2::API qw( context );

our @EXPORT_OK = qw( start_mojo );

sub start_mojo
{
  my (%args) = @_;
  my $app = $args{app};
  my $scheme = $args{ssl} ? "https" : "http";
  my $server = Mojo::Server::Daemon->new;
  my $port = generate_port();
  my $ctx = context();
  $ctx->note("port = $port");
  $ctx->release;
  $server->app($app);
  $server->listen(["$scheme://127.0.0.1:$port"]);
  $server->start;
  return ($server, $port);
}



( run in 0.952 second using v1.01-cache-2.11-cpan-acf6aa7dc9e )