turul-rpc-server
Async JSON-RPC 2.0 dispatcher, handler trait, and session context for the
turul-rpcframework.
Built on turul-rpc-core wire types and turul-rpc-jsonrpc
codec. Most consumers should depend on the turul-rpc facade,
which re-exports this crate's items.
What's here
JsonRpcDispatcher<E>— typed dispatcher. Routes incoming requests to registered handlers and converts handler-returned domain errors to JSON-RPC error responses viaToJsonRpcError. Includeshandle_batch()for JSON-RPC 2.0 §6 batch dispatch.JsonRpcHandlerasync trait — your handler returnsResult<Value, YourError>. The dispatcher owns wire-format conversion.ToJsonRpcErrortrait — implement on your domain error type to control how it maps to aJsonRpcErrorObject.SessionContext— opaque session info passed through to handlers (id, metadata, type-erased broadcaster, request-scoped extensions).- Optional
streamingmodule (featurestreams):JsonRpcFrame,StreamingJsonRpcHandler,StreamingJsonRpcDispatcherfor progressive responses.
Quick start
use ;
use JsonRpcErrorObject;
use RequestParams;
use async_trait;
use ;
;
;
# async
Features
| Feature | Default | Pulls in |
|---|---|---|
async |
yes | async-trait, futures — required for the dispatcher and handler trait |
streams |
no | async + the streaming dispatcher |
License
Dual-licensed under MIT or Apache-2.0 at your option. See the workspace README for details.