SYNOPSIS

use Test2::Tools::WebSocket::Connection qw( create_connection_pair );

my($a, $b) = create_connection_pair;

DESCRIPTION

This module provides a function for building a pair of AnyEvent::WebSocket::Connection objects that can be used for testing.

FUNCTIONS

create_connection_pair

my($a,$b) = create_connection_pair;
my($a,$b) = create_connection_pair(\%a_options, \%b_options);

This function creates a pair of connection object which are connected. When you send a message on one end it will be received on the other. The optional option hashes are passed into AnyEvent::WebSocket::Connection so you can use any option that is legal there.

create_connection_and_handle

my($connection, $handle) = create_connection_and_handle;
my($connection, $handle) = create_connection_and_handle(\%connection_options);

This is the same as create_connection_pair, except a AnyEvent::Handle object is returned for one end. This can be useful for some lower level testing.

SEEL ALSO

AnyEvent::WebSocket::Client
AnyEvent::WebSocket::Server
Test::Mojo

Also provides methods for testing websockets.