Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create a WebSocket client instance each time before connection #5

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 6 additions & 3 deletions t/websocket-client.t
Expand Up @@ -46,7 +46,8 @@ END { $http-server.stop() };

# Done testing
{
my $connection = Cro::WebSocket::Client.connect: 'http://localhost:3005/done';
my $client = Cro::WebSocket::Client.new;
my $connection = $client.connect: 'http://localhost:3005/done';

await Promise.anyof($connection, Promise.in(5));
if $connection.status != Kept {
Expand All @@ -69,7 +70,8 @@ END { $http-server.stop() };

# Ping testing
{
my $connection = Cro::WebSocket::Client.connect: 'http://localhost:3005/chat';
my $client = Cro::WebSocket::Client.new;
my $connection = $client.connect: 'http://localhost:3005/chat';

await Promise.anyof($connection, Promise.in(5));
die "Connection timed out" unless $connection;
Expand All @@ -90,7 +92,8 @@ END { $http-server.stop() };

# Chat testing
{
my $connection = Cro::WebSocket::Client.connect: 'http://localhost:3005/chat';
my $client = Cro::WebSocket::Client.new;
my $connection = $client.connect: 'http://localhost:3005/chat';

await Promise.anyof($connection, Promise.in(5));
die "Connection timed out" unless $connection;
Expand Down