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.
AnyEvent::JSONRPC provide you a couple of export functions that are shortcut of AnyEvent::JSONRPC::TCP::Client and AnyEvent::JSONRPC::TCP::Server. One is jsonrpc_client for Client, another is jsonrpc_server for Server.
jsonrpc_client
jsonrpc_server
This module is a fork of Daisuke Murase's AnyEvent::JSONRPC::Lite 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 AnyEvent::JSONRPC::TCP::Server object and return it.
This is equivalent to:
AnyEvent::JSONRPC::TCP::Server->new( address => $address, port => $port, );
See AnyEvent::JSONRPC::TCP::Server for more detail.
Create AnyEvent::JSONRPC::TCP::Client object and return it.
AnyEvent::JSONRPC::TCP::Client->new( host => $hostname, port => $port, );
See AnyEvent::JSONRPC::TCP::Client for more detail.
AnyEvent, AnyEvent::JSONRPC::Lite, JSON::RPC::Common.
http://json-rpc.org/
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.
To install AnyEvent::JSONRPC, copy and paste the appropriate command in to your terminal.
cpanm
cpanm AnyEvent::JSONRPC
CPAN shell
perl -MCPAN -e shell install AnyEvent::JSONRPC
For more information on module installation, please visit the detailed CPAN module installation guide.