Skip to main content

Crate jsonrpsee_server

Crate jsonrpsee_server 

Source
Expand description

§jsonrpsee-server

jsonrpsee-server is a JSON RPC server that supports both HTTP and WebSocket transport.

Vendored from jsonrpsee, Copyright (c) 2019-2021 Parity Technologies (UK) Ltd., licensed under the MIT License (see crates/rpc/jsonrpsee/LICENSE).

Re-exports§

pub use jsonrpsee_types as types;
pub use tracing;

Modules§

helpers
Helpers.
http
HTTP related server functionality.
middleware
jsonrpsee-server middleware
ws
WebSocket related server functionality.

Structs§

AlreadyStoppedError
Error when the server has already been stopped.
BatchResponseBuilder
Builder for the response to a batch request.
BoundedSubscriptions
This wraps [tokio::sync::Semaphore] and is used to limit the number of subscriptions per connection.
ConnectionGuard
Limits the number of connections.
ConnectionId
Connection ID.
ConnectionState
Connection related state that is needed to execute JSON-RPC calls.
DisconnectError
Error that may occur during crate::server::MethodSink::send or crate::server::SubscriptionSink::send.
HttpBody
Default HTTP body used by jsonrpsee.
IsUnsubscribed
Represents a subscription until it is unsubscribed.
MethodResponse
Represents a response to a method call.
MethodSink
Sink that is used to send back the result to the server for a specific method.
Methods
Reference-counted, clone-on-write collection of synchronous and asynchronous methods.
PendingSubscriptionAcceptError
The error returned while accepting a subscription.
PendingSubscriptionSink
Represents a single subscription that is waiting to be accepted or rejected.
RandomIntegerIdProvider
Generates random integers as subscription ID.
RandomStringIdProvider
Generates random strings of length len as subscription ID.
RpcModule
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.
Server
JSON RPC server.
ServerBuilder
Builder to configure and create a JSON-RPC server.
ServerConfig
Static server configuration which is shared per connection.
ServerConfigBuilder
The builder to configure and create a JSON-RPC server configuration.
ServerHandle
Server handle.
StopHandle
Represent a stop handle which is a wrapper over a multi-consumer receiver and cloning StopHandle will get a separate instance of the underlying receiver.
SubscriptionKey
Represent a unique subscription entry based on [SubscriptionId] and ConnectionId.
SubscriptionMessage
Subscription message.
SubscriptionSink
A handle to an active subscription.
SubscriptionState
Helper struct to manage subscriptions.
TowerServiceNoHttp
jsonrpsee tower service without HTTP specific middleware.

Enums§

BatchRequestConfig
Configuration for batch request handling.
MethodCallback
Callback wrapper that can be either sync or async.
RegisterMethodError
The error returned when registering a method or subscription failed.
ResponsePayload
Represent the payload of the JSON-RPC response object
SendTimeoutError
Error that may occur during crate::server::MethodSink::send_timeout or crate::server::SubscriptionSink::send_timeout.
SubscriptionCloseResponse
Represents what action that will sent when a subscription callback returns.
SubscriptionMessageInner
A complete subscription message or partial subscription message.
TrySendError
Error that may occur during crate::server::MethodSink::try_send or crate::server::SubscriptionSink::try_send.

Traits§

IdProvider
Trait to generate subscription IDs.
IntoResponse
Something that can be converted into a JSON-RPC method call response.
IntoSubscriptionCloseResponse
Convert something into a subscription close notification before a subscription is terminated.

Functions§

accept_error_backoff
Pauses an accept loop after accept failed with err.
handle_rpc_call
Parses body as a single JSON-RPC message (is_single) or a batch, dispatches it to rpc_service and returns the serialized response.
prepare_error
Distinguish malformed JSON from an invalid request and recover its [Id] when possible.
serve_with_graceful_shutdown
Serve a service over a TCP connection with graceful shutdown. This means that pending requests will be completed before the server is stopped.
stop_channel
Create channel to determine whether the server shall continue to run or not.

Type Aliases§

AsyncMethod
Similar to SyncMethod, but represents an asynchronous handler.
ConnectionPermit
Connection permit.
HttpRequest
HTTP request type.
HttpResponse
HTTP response type.
MaxResponseSize
Max response size.
Subscribers
Type-alias for subscribers.
SubscriptionMethod
Method callback for subscriptions.
SubscriptionPermit
Subscription permit.
SyncMethod
A MethodCallback is an RPC endpoint, callable with a standard JSON-RPC request, implemented as a function pointer to a Fn function taking four arguments: the id, params, a channel the function uses to communicate the result (or error) back to jsonrpsee, and the connection ID (useful for the websocket transport).