Skip to content

Instantly share code, notes, and snippets.

@typester
Created July 13, 2009 01:37
Show Gist options
  • Save typester/145890 to your computer and use it in GitHub Desktop.
Save typester/145890 to your computer and use it in GitHub Desktop.
use Test::Base;
use AnyEvent::JSONRPC::Lite;
my $cv = AnyEvent->condvar;
# server
my $server = AnyEvent::JSONRPC::Lite->new_server( port => 4423 );
$server->reg_cb(
echo => sub {
my ($result_cv, @params) = @_;
$result_cv->send(@params);
}
);
# client;
my $client = AnyEvent::JSONRPC::Lite->new(
host => '127.0.0.1',
port => 4423,
);
$client->call(
echo => sub {
my @params = @_;
# callback
}
);
$cv->recv;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment