Crate jsonrpsee_server
source ·Expand description
Re-exports§
pub use middleware::rpc::RpcServiceBuilder;
pub use jsonrpsee_types as types;
pub use tracing;
Modules§
- Helpers.
- HTTP related server functionality.
- jsonrpsee-server middleware
- WebSocket related server functionality.
Structs§
- Error when the server has already been stopped.
- Serialized batch response.
- Builder to build a
BatchResponse
. - This wraps
tokio::sync::Semaphore
and is used to limit the number of subscriptions per connection. - Bounded writer that allows writing at most
max_len
bytes. - Limits the number of connections.
- Connection ID.
- Connection related state that is needed to execute JSON-RPC calls.
- Error that may occur during
crate::server::MethodSink::send
orcrate::server::SubscriptionSink::send
. - A type map of protocol extensions.
- Default HTTP body used by jsonrpsee.
- Represents a subscription until it is unsubscribed.
- Represents a response to a method call.
- Future that resolves when the method response has been processed.
- Sends a message once the method response has been processed.
- Sink that is used to send back the result to the server for a specific method.
- Reference-counted, clone-on-write collection of synchronous and asynchronous methods.
- No-op implementation to be used for servers that don’t support subscriptions.
- The error returned while accepting a subscription.
- Represents a single subscription that is waiting to be accepted or rejected.
- Configuration for WebSocket ping/pong mechanism and it may be used to disconnect an inactive connection.
- Generates random integers as subscription ID.
- Generates random strings of length
len
as subscription ID. - Similar to
jsonrpsee_types::ResponsePayload
but possible to with an async-like API to detect when a method response has been sent. - Sets 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.
RpcModule
wraps an additional context argument that can be used to access data during call execution. - JSON RPC server.
- Builder to configure and create a JSON-RPC server
- Static server configuration which is shared per connection.
- Server handle.
- Represent a stop handle which is a wrapper over a
multi-consumer receiver
and cloningStopHandle
will get a separate instance of the underlying receiver. - Wrapper struct that maintains a subscription “mainly” for testing.
- Represent a unique subscription entry based on
SubscriptionId
andConnectionId
. - Subscription message.
- Represents a single subscription that hasn’t been processed yet.
- Helper struct to manage subscriptions.
- jsonrpsee tower service
- Builder for
TowerService
.
Enums§
- Configuration for batch request handling.
- This represent a response to a RPC call and
Subscribe
calls are handled differently because we want to prevent subscriptions to start before the actual subscription call has been answered. - Callback wrapper that can be either sync or async.
- The kind of the JSON-RPC method call, it can be a subscription, method call or unknown.
- Method response error.
- Result of a method, either direct value or a future of one.
- The error that can occur when
Methods::call
orMethods::subscribe
is invoked. - A message that that tells whether notification was succesful or not.
- The error returned when registering a method or subscription failed.
- Error that may occur during
crate::server::MethodSink::send_timeout
orcrate::server::SubscriptionSink::send_timeout
. - Represents what action that will sent when a subscription callback returns.
- A complete subscription message or partial subscription message.
- Error that may occur during
crate::server::MethodSink::try_send
orcrate::server::SubscriptionSink::try_send
.
Traits§
- Trait to generate subscription IDs.
- Something that can be converted into a JSON-RPC method call response.
- Convert something into a subscription close notification before a subscription is terminated.
Functions§
- Create a JSON-RPC error response.
- Figure out if this is a sufficiently complete request that we can extract an
Id
out of, or just plain unparseable garbage. - Serve a service over a TCP connection without graceful shutdown. This means that pending requests will be dropped when the server is stopped.
- Serve a service over a TCP connection with graceful shutdown. This means that pending requests will be completed before the server is stopped.
- Create channel to determine whether the server shall continue to run or not.
Type Aliases§
- Similar to
SyncMethod
, but represents an asynchronous handler. - Connection permit.
- HTTP request type.
- HTTP response type.
- Max response size.
- Raw response from an RPC A tuple containing:
- Type-alias for subscribers.
- Method callback for subscriptions.
- Subscription permit.
- A
MethodCallback
is an RPC endpoint, callable with a standard JSON-RPC request, implemented as a function pointer to aFn
function 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).