+sub _udpread
+{
+ my ($handle, $data) = @_;
+
+ my $host = $handle->peerhost;
+ my $port = $handle->peerport;
+
+ my $in = $wsjtx->handle($handle, $data, "$host:$port");
+
+ distribute($in) if $in && length $in;
+}
+
+sub _accept
+{
+ my ($id, $handle) = @_;
+ my $host = $handle->peerhost;
+ my $port = $handle->peerport;
+
+
+ my $s = $slot{"$host:$port"} = { addr => "$host:$port"};
+ my $stream = $s->{stream} = Mojo::IOLoop::Stream->new($handle);
+ $stream->on(error => sub { $stream->close; delete $s->{addr}});
+ $stream->on(close => sub { delete $s->{addr}});
+ $stream->on(read => sub {_tcpread($s, $_[1])});
+ $stream->timeout(0);
+ $stream->start;
+}
+
+sub _tcpread
+{
+ my $s = shift;
+ my $data = shift;
+
+ dbg("incoming: $data");
+}
+
+sub distribute
+{
+ my $in = shift;
+ foreach my $c (values %slot) {
+ $c->{stream}->write("$in\r\n");
+ }
+}
+
+