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§
- Combined
Dispatcher - JSON-RPC and HTTP+JSON for one
RequestHandleron one listener; see the module docs for how a request is routed.
Constants§
- DEFAULT_
JSONRPC_ PATH - The JSON-RPC path a
CombinedDispatcherstarts with.