=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 Mojolicious::Plugin::WebSocketProxy
at lib/Mojolicious/Plugin/WebSocketProxy.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
=head1 NAME
Mojolicious::Plugin::WebSocketProxy
=head1 SYNOPSYS
# lib/your-application.pm
use base 'Mojolicious';
sub startup {
my $self = shift;
$self->plugin(
'web_socket_proxy' => {
actions => [
['json_key', {some_param => 'some_value'}]
],
base_path => '/api',
url => 'http://rpc-host.com:8080/',
}
);
}
Or to manually call RPC server:
# lib/your-application.pm
use base 'Mojolicious';
sub startup {
my $self = shift;
$self->plugin(
'web_socket_proxy' => {
actions => [
[
'json_key',
{
instead_of_forward => sub {
shift->call_rpc({
args => $args,
method => $rpc_method, # it'll call 'http://rpc-host.com:8080/rpc_method'
rpc_response_cb => sub {...}
});
}
}
]
],
base_path => '/api',
url => 'http://rpc-host.com:8080/',
}
);
}
=head1 INHERITED METHODS
=over 4
=item L<Mojo::Base>
L<attr|Mojo::Base/attr>, L<import|Mojo::Base/import>, L<new|Mojo::Base/new>, L<tap|Mojo::Base/tap>
=back
=head1 DESCRIPTION
Using this module you can forward websocket JSON-RPC 2.0 requests to RPC server.
See L<Mojo::WebSocketProxy> for details on how to use hooks and parameters.
=head1 SEE ALSO
L<Mojolicious::Plugin::WebSocketProxy>,
L<Mojo::WebSocketProxy>
L<Mojo::WebSocketProxy::Backend>,
L<Mojo::WebSocketProxy::Dispatcher>
L<Mojo::WebSocketProxy::Config>
L<Mojo::WebSocketProxy::Parser>