=encoding utf8

=for comment POD_DERIVED_INDEX_GENERATED
The following documentation is automatically generated.  Please do not edit
this file, but rather the original, inline with Mojo::WebSocketProxy::Backend::JSONRPC
at lib/Mojo/WebSocketProxy/Backend/JSONRPC.pm
(on the system that originally ran this).
If you do edit this file, and don't want your changes to be removed, make
sure you change the first line.

=cut

=head2 call_rpc

Description: Makes a remote call to a  process  returning the result to the client in JSON format.
Before, After and error actions can be specified using call backs.
It takes the following arguments

=over 4

=item - $c  : L<Mojolicious::Controller>

=item - $req_storage A hashref of attributes stored with the request.  This routine uses some of the
following named arguments.

=over 4

=item - url, if not specified url set on C<$self> object is used. Must be supplied by either method.

=item - method, The name of the method at the remote end (this is appened to C<< $request_storage->{url} >> )

=item - msg_type, a name for this method if not supplied C<method> is used.

=item - call_params, a hashref of arguments on top of C<req_storage> to send to remote method. This will be suplemented with C<< $req_storage->{args} >>
added as an C<args> key and be merged with C<< $req_storage->{stash_params} >> with stash_params overwriting any matching
keys in C<call_params>.

=item - rpc_response_callback,  If supplied this will be run with C<Mojolicious::Controller> instance the rpc_response and C<$req_storage>.
B<Note:> if C<rpc_response_callback> is supplied the success and error callbacks are not used.

=item - before_get_rpc_response,  array ref of subroutines to run before the remote response, is passed C<$c> and C<req_storage>

=item - after_get_rpc_response, arrayref of subroutines to run after the remote response,  is passed C<$c> and C<req_storage>
called only when there is an actual response from the remote call .  IE if there is communication  error with the call it will
not be called versus an error message being returned from the call when it will.

=item - before_call, arrayref of subroutines called before the request to the remote service is made.

=item -  error,  a subroutine reference that will be called with C<Mojolicious::Controller> the rpc_response and C<$req_storage>
if a C<< $response->{error} >>  error was returned from the remote call, and C<< $req_storage->{rpc_response_cb} >> was not passed.

=item - success, a subroutines reference that will be called if there was no error returned from the remote call and  C<< $req_storage->{rpc_response_cb} >> was not passed.

=item - rpc_failure_cb, a sub routine reference to call if the remote call fails at a http level. Called with C<Mojolicious::Controller> the rpc_response and C<$req_storage>

=back

=back

Returns undef.

=head1 NAME

Mojo::WebSocketProxy::Backend

=head1 DESCRIPTION

A subclass of L<Mojo::WebSocketProxy::Backend> which dispatched RPC requests
over JSON-RPC over HTTP/HTTPS.

=head1 INHERITED METHODS

=over 4

=item L<Mojo::WebSocketProxy::Backend>

L<backend_instance|Mojo::WebSocketProxy::Backend/backend_instance>, L<error_api_response|Mojo::WebSocketProxy::Backend/error_api_response>, L<get_rpc_response_cb|Mojo::WebSocketProxy::Backend/get_rpc_response_cb>, L<make_call_params|Mojo::WebSocketProxy::Backend/make_call_params>, L<new|Mojo::WebSocketProxy::Backend/new>, L<register_type|Mojo::WebSocketProxy::Backend/register_type>, L<store_response|Mojo::WebSocketProxy::Backend/store_response>, L<success_api_response|Mojo::WebSocketProxy::Backend/success_api_response>

=back

=head1 METHODS

=head2 url

    $url = $backend->url

Returns the configured default dispatch URL.

=head2 call_rpc

Implements the L<Mojo::WebSocketProxy::Backend/call_rpc> interface.

=head1 SEE ALSO

L<Mojolicious::Plugin::WebSocketProxy>,
L<Mojo::WebSocketProxy>
L<Mojo::WebSocketProxy::Dispatcher>,
L<Mojo::WebSocketProxy::Config>
L<Mojo::WebSocketProxy::Parser>