| AnyEvent::JSONRPC - Simple TCP-based JSONRPC client/server |
AnyEvent::JSONRPC - Simple TCP-based JSONRPC client/server
use AnyEvent::JSONRPC;
my $server = jsonrpc_server '127.0.0.1', '4423';
$server->reg_cb(
echo => sub {
my ($res_cv, @params) = @_;
$res_cv->result(@params);
},
);
my $client = jsonrpc_client '127.0.0.1', '4423';
my $d = $client->call( echo => 'foo bar' );
my $res = $d->recv; # => 'foo bar';
This module provide TCP-based JSONRPC server/client implementation.
the AnyEvent::JSONRPC manpage provide you a couple of export functions that are
shortcut of the AnyEvent::JSONRPC::TCP::Client manpage and the AnyEvent::JSONRPC::TCP::Server manpage.
One is jsonrpc_client for Client, another is jsonrpc_server for Server.
This module is a fork of Daisuke Murase's the AnyEvent::JSONRPC::Lite manpage updated to use Yuval Kogman's JSON::RPC::Common for handling the JSONRPC messages. This enables support for handling messages complying to all versions of the JSONRPC standard.
The System Services/Service Description parts of version 1.1-wd and 1.1-alt is unimplemented and left to users to implement.
As none of the specs really defines JSON-RPC over TCP I consider this module an otherwise full-spec implementation.
Create the AnyEvent::JSONRPC::TCP::Server manpage object and return it.
This is equivalent to:
AnyEvent::JSONRPC::TCP::Server->new(
address => $address,
port => $port,
);
See the AnyEvent::JSONRPC::TCP::Server manpage for more detail.
Create the AnyEvent::JSONRPC::TCP::Client manpage object and return it.
This is equivalent to:
AnyEvent::JSONRPC::TCP::Client->new(
host => $hostname,
port => $port,
);
See the AnyEvent::JSONRPC::TCP::Client manpage for more detail.
AnyEvent, the AnyEvent::JSONRPC::Lite manpage, the JSON::RPC::Common manpage.
Peter Makholm <peter@makholm.net>
Copyright (c) 2010 by Peter Makholm.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
The full text of the license can be found in the LICENSE file included with this module.
| AnyEvent::JSONRPC - Simple TCP-based JSONRPC client/server |