1 package Tak::ConnectionService;
3 use Tak::ConnectionReceiver;
7 has receiver => (is => 'ro', writer => '_set_receiver');
9 has channel => (is => 'ro', writer => '_set_channel');
12 my ($self, $args) = @_;
13 my $channel = $self->_set_channel(
14 Tak::JSONChannel->new(map +($_ => $args->{$_}), qw(read_fh write_fh))
16 my $receiver = $self->_set_receiver(
17 Tak::ConnectionReceiver->new(
18 channel => $channel, service => $args->{listening_service},
19 on_close => $args->{on_close},
25 my ($self, $req, @payload) = @_;
26 $self->receiver->requests->{my $tag = "$req"} = $req;
27 my $meta = { progress => !!$req->on_progress };
28 $self->channel->write_message(request => $tag => $meta => @payload);
32 my ($self, @payload) = @_;
33 $self->channel->write_message(message => @payload);