Skip to main content

Module combined

Module combined 

Source
Expand description

JSON-RPC and HTTP+JSON on one listener.

Serving both bindings on one port took a hand-written hyper accept loop (about 25 lines, written three times in this repository’s examples), because serve and Server take one Dispatcher. CombinedDispatcher is that one dispatcher.

The two bindings’ routes do not overlap, so the split is by route: a POST to the JSON-RPC path, and its CORS preflight (OPTIONS), go to JsonRpcDispatcher; every other request goes to RestDispatcher. That includes the agent card, the health probes and every HTTP+JSON route, tenant-prefixed or not. Every HTTP+JSON route that takes a POST ends in a :-suffixed action (/message:send, /tasks/{id}:cancel) or lies below /tasks/, so a JSON-RPC path of one segment without a : is never one of them; with_jsonrpc_path refuses any other.

Structs§

CombinedDispatcher
JSON-RPC and HTTP+JSON for one RequestHandler on one listener; see the module docs for how a request is routed.

Constants§

DEFAULT_JSONRPC_PATH
The JSON-RPC path a CombinedDispatcher starts with.