NAME

AnyEvent::JSONRPC::Lite - Simple TCP-based JSONRPC client/server

SYNOPSIS

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';

DESCRIPTION

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.

WHY I NAMED "Lite" TO THIS MODULE

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)

FUNCTIONS

jsonrpc_server $address, $port;

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.

jsonrpc_client $hostname, $port

Create AnyEvent::JSONRPC::Lite::Client object and return it.

This is equivalent to:

AnyEvent::JSONRPC::Lite::Client->new(
    host => $hostname,
    port => $port,
);

See AnyEvent::JSONRPC::Lite::Client for more detail.

SEE ALSO

AnyEvent::JSONRPC::Lite::Client, AnyEvent::JSONRPC::Lite::Server.

http://json-rpc.org/

AUTHOR

Daisuke Murase <typester@cpan.org>

COPYRIGHT AND LICENSE

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.