NAME

Mojo::WebSocketProxy::Backend

DESCRIPTION

Abstract base class for RPC dispatch backends. See Mojo::WebSocketProxy::Backend::JSONRPC for the original JSON::RPC backend.

CLASS METHODS

register_type

$class->register_type($type)

Registers that the invoking subclass implements an RPC backend of the given type.

backend_instance

$backend = Mojo::WebSocketProxy::Backend->new($type, %args)

Constructs a new instance of the subclass previously registered as handling the given type. Throws an exception of no such class exists.

METHODS - For backend classes

These will be inherited by backend implementations and can be used for some common actions when processing requests and responses.

new

$backend = $class->new(%args)

Returns a new blessed HASH reference containing the given arguments.

make_call_params

Make RPC call params.

$backend->make_call_params($c, $req_storage)

Method params: stash_params - it contains params to forward from server storage.

get_rpc_response_cb

Returns the stored callback for this response if we have one, otherwise an empty list.

store_response

Save RPC response to storage.

success_api_response

Make wsapi proxy server response from RPC response.

error_api_response

Make wsapi proxy server response from RPC response.

REQUIRED METHODS - subclasses must implement

call_rpc

$f = $backend->call_rpc($c, $req_storage)

Invoked to actually dispatch a given RPC method call to the backend.