AnyEvent-WebSocket-Client

 view release on metacpan or  search on metacpan

MANIFEST  view on Meta::CPAN

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
t/lib/Test2/Tools/WebSocket/Connection.pm
t/lib/Test2/Tools/WebSocket/Mojo.pm
t/lib/Test2/Tools/WebSocket/Server.pm
t/mojo.t
t/mojo_echo.t
t/mojo_receive.t
xt/author/critic.t

README  view on Meta::CPAN


    The recommended API was added to the AnyEvent::WebSocket::Connection
    class with version 0.12, so it is recommended that you include that
    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

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


The recommended API was added to the L<AnyEvent::WebSocket::Connection>
class with version 0.12, so it is recommended that you include that version
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

t/anyevent_websocket_client.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Server qw( start_server start_echo );
use AnyEvent::WebSocket::Client;

subtest 'new' => sub {

  my $client = AnyEvent::WebSocket::Client->new;
  isa_ok $client, 'AnyEvent::WebSocket::Client';

};

t/anyevent_websocket_client__proxy.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use AnyEvent;
use AnyEvent::WebSocket::Client;

sub get_env {
    my ($env_name, $desc) = @_;
    my $val = $ENV{$env_name};
    if(!defined($val) || $val eq "") {
        skip_all "Set $env_name environment variable to $desc to enable this test.";
    }

t/anyevent_websocket_client__scope.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::Module 'Capture::Tiny';
use Test2::Require::Module 'Test::Memory::Cycle';
use Test2::Require::Module 'Devel::Cycle';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Server qw( start_server );
use AnyEvent::WebSocket::Client;
use Capture::Tiny qw( capture_stderr );
use Test::Memory::Cycle;

my $finished = 0;
my $done1 = AnyEvent->condvar;
my $done2 = AnyEvent->condvar;

t/anyevent_websocket_client__server_initial_data_shutdown.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::SSL ();
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Server qw( start_server );
use AnyEvent::WebSocket::Client;

my @test_cases = (
  { label => 'without TLS', tls => 0,                                     },
  { label => 'with TLS',    tls => 1, tls_cert => do { local $/; <DATA> } },
);

foreach my $test_case (@test_cases)

t/anyevent_websocket_client__ssl.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::SSL;
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Server qw( start_server );
use AnyEvent::WebSocket::Client;

my $counter;
my $max;

my $uri = start_server(
  tls => AnyEvent::TLS->new(cert => do { local $/; <DATA> }),
  handshake => sub {  # handshake

t/anyevent_websocket_connection.t  view on Meta::CPAN

use utf8;
use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Connection qw( create_connection_pair create_connection_and_handle );
use AnyEvent::WebSocket::Connection;

subtest 'send' => sub {

  my($x,$y) = create_connection_pair;

  my $round_trip = sub {

t/anyevent_websocket_connection__counter_shutdown.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use AnyEvent::WebSocket::Connection;
use Test2::Tools::WebSocket::Connection qw( create_connection_and_handle );

note(<<ENDNOTE);
Connection should shutdown its socket when the peer shuts down.
This is because in some cases the socket is still half-open (writable)
when it detects the shutdown from its peer. If it remains half-open,
the peer never gets EOF on its reading socket.
ENDNOTE

t/anyevent_websocket_connection__destroy_in_callbacks.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Connection qw( create_connection_pair );
use AnyEvent::WebSocket::Connection;
use Scalar::Util qw(weaken);

note("It should be safe (exception-free) to destroy the Connection object in callbacks.");

sub test_case
{
  my ($label, $a_conn_code, $b_conn_code) = @_;

t/anyevent_websocket_connection__finish_callback.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Connection qw( create_connection_pair );
use AnyEvent::WebSocket::Connection;

note("finish callback should be called only once");

sub test_case
{
  my ($label, $code) = @_;
  subtest $label, sub {

t/anyevent_websocket_connection__payload_size.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Plugin::EV;
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Connection qw( create_connection_and_handle );
use AnyEvent::WebSocket::Connection;
use AE;
use AnyEvent::WebSocket::Connection;
use Protocol::WebSocket::Frame;

my $connection;

{

t/lib/Test2/Plugin/AnyEvent/Timeout.pm  view on Meta::CPAN

package Test2::Plugin::AnyEvent::Timeout;

use strict;
use warnings;
use Test2::API qw( context );
use AnyEvent;

our $timeout;

# ABSTRACT: Set a timeout for tests that use AnyEvent
# VERSION

=head1 SYNOPSIS

 use Test2::V0;
 use Test2::Plugin::AnyEvent::Timeout;
 use AnyEvent;
 
 my $cv = AnyEvent->condvar;
 $cv->recv;

=head1 DESCRIPTION

Every now and then I used to get bug reports from cpantesters that
my L<AnyEvent> based modules were getting stuck in an infinite loop.
That is not a nice thing to do!  So I woul rewrite the tests to add

t/mojo.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::NotWindows;
use Test2::Require::Module 'EV';
use Test2::Require::Module 'Mojolicious' => '3.0';
use Test2::Require::Module 'Mojolicious::Lite';
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Mojo qw( start_mojo );
use AnyEvent::WebSocket::Client;
use Mojolicious::Lite;

# NOTE: The mojo_* tests are to test interoperability with a really
# good implementation that is also written in Perl.  Mojolicious
# tests should not be written for new features and to test bugs,
# unless they are also accompanied by a non-Mojolicious test as well!

t/mojo_echo.t  view on Meta::CPAN

use lib 't/lib';
use Test2::Require::NotWindows;
use Test2::Require::Module 'EV';
use Test2::Require::Module 'Mojolicious' => '3.0';
use Test2::Require::Module 'Mojolicious::Lite';
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Mojo qw( start_mojo );
use AnyEvent::WebSocket::Client;
use Mojolicious::Lite;

# NOTE: The mojo_* tests are to test interoperability with a really
# good implementation that is also written in Perl.  Mojolicious
# tests should not be written for new features and to test bugs,
# unless they are also accompanied by a non-Mojolicious test as well!

t/mojo_receive.t  view on Meta::CPAN

use utf8;
use lib 't/lib';
use Test2::Require::NotWindows;
use Test2::Require::Module 'EV';
use Test2::Require::Module 'Mojolicious' => '3.0';
use Test2::Require::Module 'Mojolicious::Lite';
use Test2::Plugin::AnyEvent::Timeout;
use Test2::V0 -no_srand => 1;
use Test2::Tools::WebSocket::Mojo qw( start_mojo );
use AnyEvent::WebSocket::Client;
use Mojolicious::Lite;
use Protocol::WebSocket;
use Encode qw(encode);

# NOTE: The mojo_* tests are to test interoperability with a really
# good implementation that is also written in Perl.  Mojolicious
# tests should not be written for new features and to test bugs,

 view all matches for this distribution
 view release on metacpan -  search on metacpan

( run in 1.098 second using v1.00-cache-2.02-grep-82fe00e-cpan-cec75d87357c )