Expand description
jsonrpsee wrapper crate.
§Optional features
The jsonrpsee crate composes JSON-RPC functionality behind optional feature
flags to provide for client and server communication over specific protocols.
There are no default features, all functionality must be opted in to accordingly.
The following features are available.
http-client- JSON-RPC client functionality over HTTP protocol.wasm-client- JSON-RPC client functionality over web-sys.ws-client- JSON-RPC client functionality over WebSocket protocol.macros- JSON-RPC API generation convenience by derive macros.client-core- Enables minimal client features to generate the RPC API without transports.client- Enables all client features including transports.server-core- Enables minimal server features to generate the RPC API without transports.server- Enables all server features including transports.full- Enables all features.async-client- Enables the async client without any transport.client-ws-transport- Enableswstransport with TLS.client-ws-transport-no-tls- Enableswstransport without TLS.client-web-transport- Enableswebsystransport.
Re-exports§
pub use jsonrpsee_http_client as http_client;jsonrpsee-http-clientpub use jsonrpsee_ws_client as ws_client;jsonrpsee-ws-clientpub use jsonrpsee_wasm_client as wasm_client;jsonrpsee-wasm-clientpub use jsonrpsee_client_transport as client_transport;jsonrpsee-client-transportpub use jsonrpsee_server as server;serverpub use tokio;serverpub use jsonrpsee_proc_macros as proc_macros;jsonrpsee-proc-macrospub use tracing;jsonrpsee-proc-macrospub use jsonrpsee_types as types;jsonrpsee-typespub use jsonrpsee_core as core;
Modules§
- async_client
async-clientAbstract async client. - helpers
serverHelpers.
Macros§
- Convert the given values to a
crate::params::ArrayParamsas expected by a jsonrpsee Client (http or websocket).
Structs§
- BatchResponse
serverSerialized batch response. - BatchResponseBuilder
serverBuilder to build aBatchResponse. - BoundedSubscriptions
serverThis wrapstokio::sync::Semaphoreand is used to limit the number of subscriptions per connection. - BoundedWriter
serverBounded writer that allows writing at mostmax_lenbytes. - DisconnectError
serverError that may occur duringcrate::server::MethodSink::sendorcrate::server::SubscriptionSink::send. - IsUnsubscribed
serverRepresents a subscription until it is unsubscribed. - MethodResponse
serverRepresents a response to a method call. - MethodResponseFuture
serverFuture that resolves when the method response has been processed. - MethodResponseNotifyTx
serverSends a message once the method response has been processed. - MethodSink
serverSink that is used to send back the result to the server for a specific method. - Methods
serverReference-counted, clone-on-write collection of synchronous and asynchronous methods. - The error returned while accepting a subscription.
- PendingSubscriptionSink
serverRepresents a single subscription that is waiting to be accepted or rejected. - ResponsePayload
serverSimilar tojsonrpsee_types::ResponsePayloadbut possible to with an async-like API to detect when a method response has been sent. - RpcModule
serverSets of JSON-RPC methods can be organized into “module“s that are in turn registered on the server or, alternatively, merged with other modules to construct a cohesive API.RpcModulewraps an additional context argument that can be used to access data during call execution. - Subscription
serverWrapper struct that maintains a subscription “mainly” for testing. - SubscriptionKey
serverRepresent a unique subscription entry based onSubscriptionIdandConnectionId. - SubscriptionMessage
serverSubscription message. - SubscriptionSink
serverRepresents a single subscription that hasn’t been processed yet. - SubscriptionState
serverHelper struct to manage subscriptions.
Enums§
- CallOrSubscription
serverThis represent a response to a RPC call andSubscribecalls are handled differently because we want to prevent subscriptions to start before the actual subscription call has been answered. - MethodCallback
serverCallback wrapper that can be either sync or async. - MethodKind
serverThe kind of the JSON-RPC method call, it can be a subscription, method call or unknown. - MethodResponseError
serverMethod response error. - MethodResult
serverResult of a method, either direct value or a future of one. - MethodsError
serverThe error that can occur whenMethods::callorMethods::subscribeis invoked. - NotifyMsg
serverA message that that tells whether notification was succesful or not. - SendTimeoutError
serverError that may occur duringcrate::server::MethodSink::send_timeoutorcrate::server::SubscriptionSink::send_timeout. - Represents what action that will sent when a subscription callback returns.
- SubscriptionMessageInner
serverA complete subscription message or partial subscription message. - TrySendError
serverError that may occur duringcrate::server::MethodSink::try_sendorcrate::server::SubscriptionSink::try_send.
Traits§
- IntoResponse
serverSomething that can be converted into a JSON-RPC method call response. - Convert something into a subscription close notification before a subscription is terminated.
Functions§
- batch_response_error
serverCreate a JSON-RPC error response. - prepare_error
serverFigure out if this is a sufficiently complete request that we can extract anIdout of, or just plain unparseable garbage.
Type Aliases§
- AsyncMethod
serverSimilar toSyncMethod, but represents an asynchronous handler. - ConnectionId
serverConnection ID, used for stateful protocol such as WebSockets. For stateless protocols such as http it’s unused, so feel free to set it some hardcoded value. - MaxResponseSize
serverMax response size. - RawRpcResponse
serverRaw response from an RPC A tuple containing: - Subscribers
serverType-alias for subscribers. - SubscriptionMethod
serverMethod callback for subscriptions. - SubscriptionPermit
serverSubscription permit. - SyncMethod
serverAMethodCallbackis an RPC endpoint, callable with a standard JSON-RPC request, implemented as a function pointer to aFnfunction taking four arguments: theid,params, a channel the function uses to communicate the result (or error) back tojsonrpsee, and the connection ID (useful for the websocket transport).