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

- $c : Mojolicious::Controller
- $req_storage A hashref of attributes stored with the request. This routine uses some of the, following named arguments.
- url, if not specified url set on $self object is used. Must be supplied by either method.
- method, The name of the method at the remote end (this is appened to $request_storage->{url} )
- msg_type, a name for this method if not supplied method is used.
- call_params, a hashref of arguments on top of req_storage to send to remote method. This will be suplemented with $req_storage->{args} added as an args key and be merged with $req_storage->{stash_params} with stash_params overwriting any matching keys in call_params.
- rpc_response_callback, If supplied this will be run with Mojolicious::Controller instance the rpc_response and $req_storage. Note: if rpc_response_callback is supplied the success and error callbacks are not used.
- before_get_rpc_response, array ref of subroutines to run before the remote response, is passed $c and req_storage
- after_get_rpc_response, arrayref of subroutines to run after the remote response, is passed $c and 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.
- before_call, arrayref of subroutines called before the request to the remote service is made.
- error, a subroutine reference that will be called with Mojolicious::Controller the rpc_response and $req_storage if a $response->{error} error was returned from the remote call, and $req_storage->{rpc_response_cb} was not passed.
- success, a subroutines reference that will be called if there was no error returned from the remote call and $req_storage->{rpc_response_cb} was not passed.
- rpc_failure_cb, a sub routine reference to call if the remote call fails at a http level. Called with Mojolicious::Controller the rpc_response and $req_storage

Returns undef.

NAME

Mojo::WebSocketProxy::Backend

DESCRIPTION

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

METHODS

url

    $url = $backend->url

Returns the configured default dispatch URL.

call_rpc

Implements the "call_rpc" in Mojo::WebSocketProxy::Backend interface.

SEE ALSO

Mojolicious::Plugin::WebSocketProxy, Mojo::WebSocketProxy Mojo::WebSocketProxy::Dispatcher, Mojo::WebSocketProxy::Config Mojo::WebSocketProxy::Parser