Copyright © 2007-2010, 2011, 2012 Tony Garnock-Jones and 2007-2010 LShift Ltd.
Introduced in: 1.2.0
Authors: Tony Garnock-Jones (tonygarnockjones@gmail.com), LShift Ltd. (query@lshift.net).
References
Support for serving JSON-RPC via Mochiweb.
Familiarity with writing Mochiweb applications is assumed.
AliasPrefix
(see rfc4627_jsonrpc_http:invoke_service_method/4
).handle/2
with your AliasPrefix
and the request.AliasPrefix
, it will be decoded and the JSON-RPC service it names
will be invoked.
handle/2 | If the request matches AliasPrefix , the corresponding
JSON-RPC service is invoked, and an {ok, Response} is returned;
otherwise, no_match is returned. |
handle(AliasPrefix::string(), Req::#mochiweb_request{}) -> no_match | {ok, Response}
If the request matches AliasPrefix
, the corresponding
JSON-RPC service is invoked, and an {ok, Response}
is returned;
otherwise, no_match
is returned.
Call this function from your Mochiweb application's loop
function, as follows:
case rfc4627_jsonrpc_mochiweb:handle("/rpc", Req) of no_match -> handle_non_jsonrpc_request(Req); {ok, Response} -> Req:respond(Response) endwhere
handle_non_jsonrpc_request
does the obvious thing for
non-JSON-RPC requests.
Generated by EDoc, Nov 21 2012, 14:49:54.