package JSON::RPC2::TwoWay;
use 5.10.0;
use strict;
use warnings;
our $VERSION = '0.08'; # VERSION
# standard perl
use Carp;
use Data::Dumper;
# cpan
use JSON::MaybeXS qw();
# us
use JSON::RPC2::T
y STDERR @_ },
json => $opt{json} // JSON::MaybeXS->new(utf8 => 1),
methods => {},
};
return bless $self, $class;
}
sub newconnection {
my ($self, %opt) = @_;
my $conn = JSON::RPC2::TwoWay::C
r => $opt{owner},
write => $opt{write},
debug => $self->{debug} ? $self->{log} : 0,
json => $self->{json},
);
return $conn
}
sub register {
my ($self, $name, $cb, %opts) = @_;
my %defaults
package JSON::RPC2::TwoWay::Connection;
use 5.10.0;
use strict;
use warnings;
our $VERSION = '0.08'; # VERSION
# standard perl
use Carp;
use Data::Dumper;
use Digest::MD5 qw(md5_base64);
use Scalar
HiRes::time;
# cpan
use JSON::MaybeXS qw();
use constant ERR_REQ => -32600;
sub new {
my ($class, %opt) = @_;
croak 'no rpc?' unless $opt{rpc} and $opt{rpc}->isa('JSON::RPC2::TwoWay');
#croak
@_ },
next_id => 1,
owner => $opt{owner},
request => undef,
rpc => $opt{rpc},
json => $opt{rpc}->{json},
state => undef,
write => $opt{write},
};
weaken $self->{owner};
return bless $