Features
Nerdbank.JsonRpc provides strongly typed JSON-RPC requests, notifications, and server dispatch over MessagePack or UTF-8 JSON. MessagePack is the default encoding.
- Typed RPC: Register server targets using PolyType method shapes and call methods through typed APIs. Get started.
- Choice of encoding and framing: Configure a MessagePack or JSON serializer; JSON supports newline-delimited and
Content-Lengthframing. Choose an encoding. - Generated client proxies: Attach an interface-backed proxy instead of constructing requests manually, with positional or named arguments. Use client proxies.
- Method name transforms: CLR method names map to camelCase wire names by default, with explicit names and StreamJsonRpc interop supported. Configure method naming.
- Events as notifications: Raising a CLR event on a registered target sends a JSON-RPC notification to the remote party. Send events as notifications.
- Batching: Send several independent requests or notifications in one JSON-RPC payload. Send a batch.
- Exotic types: Marshal interfaces,
IObserver<T>,IProgress<T>, streams and pipes, andIAsyncEnumerable<T>by reference instead of by value. Marshal objects by reference. - Cancellation and failure handling: Propagate cancellation and distinguish malformed protocol envelopes from application-value conversion failures. Understand protocol behavior.
- Main-thread deadlock mitigation: Set a
JoinableTaskFactoryto propagateJoinableTaskcontext across processes, compatible with StreamJsonRpc. Learn more. - Security guidance: Understand what the library protects, and what you must provide, such as authenticating the connection before attaching JSON-RPC. Review security considerations.
- Ordered dispatch: Inbound requests start executing in the order the remote party sent them, while still running on the thread pool and executing concurrently. Configurable via JsonRpc.SynchronizationContext. Learn more.