NAME

XAS::Lib::RPC::JSON::Client - A mixin for a JSON RPC interface

SYNOPSIS

package Client

use XAS::Class
    debug   => 0,
    version => '0.01',
    base    => 'XAS::Lib::RPC::JSON::Client',
;

package main

 my $client = Client->new(
    -port => 9505,
    -host => 'localhost',
);

$client->connect();

my $data = $client->call(
    -method => 'test'
    -id     => $id,
    -params => {}
);

$client->disconnect();

DESCRIPTION

This modules implements a simple JSON RPC v2.0 client. It doesn't support "Notification" calls.

METHODS

new

This module inherits from XAS::Lib::Net::Client.

call

This method is used to format the JSON packet and send it to the server. Any errors returned from the server are parsed and then thrown.

-method

The name of the RPC method to invoke.

-id

The id used to identify this method call.

-params

A hashref of the parameters to be passed to the method.

SEE ALSO

XAS::Lib::RPC::JSON::Server
XAS

AUTHOR

Kevin L. Esteb, <kevin@kesteb.us>

COPYRIGHT AND LICENSE

Copyright (c) 2012-2015 Kevin L. Esteb

This is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license at http://www.perlfoundation.org/artistic_license_2_0.