AnyEvent::JSONRPC::Lite - Simple TCP-based JSONRPC client/server
use AnyEvent::JSONRPC::Lite; 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.
AnyEvent::JSONRPC::Lite provide you a couple of export functions that are shortcut of AnyEvent::JSONRPC::Lite::Client and AnyEvent::JSONRPC::Lite::Server. One is jsonrpc_client for Client, another is jsonrpc_server for Server.
jsonrpc_client
jsonrpc_server
This module implement only JSONRPC 1.0's TCP part, not HTTP protocol, and not full of JSONRPC 2.0 spec. But I think this is enough as simple RPC client/server, so I don't want to implement 2.0 things at this point.
That's why this module name is AnyEvent::JSONRPC::Lite, not AnyEvent::JSONRPC (this should be full-spec)
Create AnyEvent::JSONRPC::Lite::Server object and return it.
This is equivalent to:
AnyEvent::JSONRPC::Lite::Server->new( address => $address, port => $port, );
See AnyEvent::JSONRPC::Lite::Server for more detail.
Create AnyEvent::JSONRPC::Lite::Client object and return it.
AnyEvent::JSONRPC::Lite::Client->new( host => $hostname, port => $port, );
See AnyEvent::JSONRPC::Lite::Client for more detail.
AnyEvent::JSONRPC::Lite::Client, AnyEvent::JSONRPC::Lite::Server.
http://json-rpc.org/
Daisuke Murase <typester@cpan.org>
Copyright (c) 2009 by KAYAC Inc.
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.
To install AnyEvent::JSONRPC::Lite, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::JSONRPC::Lite
CPAN shell
perl -MCPAN -e shell install AnyEvent::JSONRPC::Lite
For more information on module installation, please visit the detailed CPAN module installation guide.