use 5.22.1;
use JSON;
+use DXDebug;
my $json;
+sub new
+{
+ return bless {}, 'WSJTX';
+}
+
sub handle
{
my ($self, $handle, $data) = @_;
my $lth = length $data;
dbgdump('udp', "UDP IN lth: $lth", $data);
-
+ return 1;
+
}
sub finish
use WSJTX;
our $udp_host = '0.0.0.0';
-our $udp_port = 2237;
+our $udp_port = 59387; # 2237;
our $tcp_host = '::';
our $tcp_port = 2238;
$uh = DXUDP->new;
$uh->start(host => $udp_host, port => $udp_port) or die "Cannot listen on $udp_host:$udp_port $!\n";
-$wsjtx = WSJTX->new();
-$uh->on(read => sub {wstjx->handle(@_)});
+$wsjtx = WSJTX->new;
+$uh->on(read => \&_read);
Mojo::IOLoop->start() unless Mojo::IOLoop->is_running;
+sub _read
+{
+ my ($handle, $data) = @_;
+
+# say "before handle";
+
+ $wsjtx->handle($handle, $data);
+
+# say "after handle";
+
+# my $lth = length $data;
+# dbgdump('udp', "UDP IN lth: $lth", $data);
+}
+
exit;