1MojoX::JSON::RPC::DispaUtscehrerC(o3n)tributed Perl DocuMmoejnotXa:t:iJoSnON::RPC::Dispatcher(3)
2
3
4

NAME

6       MojoX::JSON::RPC::Dispatcher - A JSON-RPC 2.0 server for Mojolicious
7

SYNOPSIS

9           # lib/your-application.pm
10
11           use base 'Mojolicious';
12           use MojoX::JSON::RPC::Service;
13
14           sub startup {
15               my $self = shift;
16               my $svc = MojoX::JSON::RPC::Service->new;
17
18               $svc->register(
19                   'sum',
20                   sub {
21                       my @params = @_;
22                       my $sum = 0;
23                       $sum += $_ for @params;
24                       return $sum;
25                   }
26               );
27
28               $self->plugin(
29                   'json_rpc_dispatcher',
30                   services => {
31                      '/jsonrpc' => $svc
32                   }
33               );
34          }
35

DESCRIPTION

37       Using this module you can handle JSON-RPC 2.0 requests within
38       Mojolicious.
39

ATTRIBUTES

41       MojoX::JSON::RPC::Dispatcher inherits all attributes from
42       Mojolicious::Controller and implements the following attributes.
43
44   "json"
45       JSON encoder / decoder
46
47   "error_code"
48       Error code.
49
50   "error_message"
51       Error message.
52
53   "error_data"
54       Error data.
55
56   "id"

METHODS

58       MojoX::JSON::RPC::Dispatcher inherits all methods from
59       Mojolicious::Controller and implements the following new ones.
60
61   "call"
62       Process JSON-RPC call.
63

SEE ALSO

65       MojoX::JSON::RPC, Mojolicious::Plugin::JsonRpcDispatcher
66
67
68
69perl v5.30.0                      2019-07-26   MojoX::JSON::RPC::Dispatcher(3)
Impressum