Added client side Connection handling and basic UI updating. NO CSS UPDATES YET

This commit is contained in:
2020-09-11 12:12:08 -06:00
parent e124349ef6
commit 9a2d6309b7
2 changed files with 118 additions and 74 deletions

View File

@@ -311,7 +311,7 @@ my $server = Net::WebSocket::Server->new(
$conn->send_utf8('{"info":"user success"}');
}
if (defined($messageData->{session})) {
unless(defined($conn->{user})) { $conn->send_utf8('{"error":200, "message":Could not join session, no user defined", "request":"user"}'); $conn->send_utf8('{"request":"session"}'); return 0; }
unless(defined($conn->{user})) { $conn->send_utf8('{"error":200, "message":"Could not join session, no user defined", "request":"user"}'); $conn->send_utf8('{"request":"session"}'); return 0; }
$conn->{session} = $messageData->{session};
$conn->send_utf8('{"info":"session success", "request":"join"}');
}
@@ -346,7 +346,12 @@ my $server = Net::WebSocket::Server->new(
$current->send_utf8('{"pools":'.to_json(\%poolStats).'}');
# Users Hands
my @hands = getHands($sessionID,$conn->{user});
$current->send_utf8('{"hands":'.to_json(\@hands).'}');
my %handStats = ();
for (@hands) {
$handStats{$_}{name} = $_;
$handStats{$_}{cards} = [];
}
$current->send_utf8('{"hands":'.to_json(\%handStats).'}');
# for each hand
for (@hands) {
my $handID = $_;