NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
crates.io · #2207 most downloaded on crates.io
JSON-RPC client transports
Last release 8 days ago
30 Sep 2026
Release timing varies
gaps range from 9 days to 7 months
Nearly every release is documented
notes for 48 of 52 stable releases
1 version withdrawn
withdrawn after publishing
5 years old
53 releases · first in 2021
One column per quarter.
chore(deps): bump actions/checkout from 4.2.2 to 4.3.0 by @dependabot [bot] in #1596
Full Changelog: v0.26.0...v0.26.1
A small patch release that exposes a connect timeout for the HTTP client, bounds the WebSocket handshake of the
client by connection_timeout and makes the server close connections that don't send a request in time.
It also raises the MSRV to 1.87.
yoke-derive 0.8.3 (a transitive dependency of url)connection_timeoutServerConfigBuilder::set_first_request_timeoutSubscriptionSink no longer closes the remaining subscription (#1650)This is just a small release; the only breaking change is the addition of max_frame_size to WsTransportClientBuilder , which necessitates a minor vers…
This is just a small release; the only breaking change is the addition of max_frame_size to WsTransportClientBuilder, which necessitates a minor version bump.
The other changes are as follows:
TowerServiceNoHttp type (#1588)jsonrpsee_http_client::RpcService (#1574)If you are updating from v0.24, have a look at https://github.com/paritytech/jsonrpsee/releases/tag/v0.25.0 because it contains some breaking changes.
A small follow-up patch release that adds a Clone impl for the middleware RpcLogger which was missing
and broke the Clone impl for the HttpClient.
If you are updating from v0.24, have a look at https://github.com/paritytech/jsonrpsee/releases/tag/v0.25.0 because it contains some breaking changes.
Full Changelog: v0.25.0...v0.25.1
A new breaking release which has been in the making for a while and the biggest change is that the RpcServiceT trait has been changed to support both
A new breaking release which has been in the making for a while and the biggest change is that the
RpcServiceT trait has been changed to support both the client and server side:
pub trait RpcServiceT {
/// Response type for `RpcServiceT::call`.
type MethodResponse;
/// Response type for `RpcServiceT::notification`.
type NotificationResponse;
/// Response type for `RpcServiceT::batch`.
type BatchResponse;
/// Processes a single JSON-RPC call, which may be a subscription or regular call.
fn call<'a>(&self, request: Request<'a>) -> impl Future<Output = Self::MethodResponse> + Send + 'a;
/// Processes multiple JSON-RPC calls at once, similar to `RpcServiceT::call`.
///
/// This method wraps `RpcServiceT::call` and `RpcServiceT::notification`,
/// but the root RPC service does not inherently recognize custom implementations
/// of these methods.
///
/// As a result, if you have custom logic for individual calls or notifications,
/// you must duplicate that implementation in this method or no middleware will be applied
/// for calls inside the batch.
fn batch<'a>(&self, requests: Batch<'a>) -> impl Future<Output = Self::BatchResponse> + Send + 'a;
/// Similar to `RpcServiceT::call` but processes a JSON-RPC notification.
fn notification<'a>(&self, n: Notification<'a>) -> impl Future<Output = Self::NotificationResponse> + Send + 'a;
}The reason for this change is to make it work for the client-side as well as make it easier to
implement performantly by relying on impl Future instead of requiring an associated type for the Future (which in many cases requires boxing).
The downside of this change is that one has to duplicate the logic in the batch and call method to achieve the same
functionality as before. Thus, call or notification is not being invoked in the batch method and one has to implement
them separately.
For example now it's possible to write middleware that counts the number of method calls as follows (both client and server):
#[derive(Clone)]
pub struct Counter<S> {
service: S,
count: Arc<AtomicUsize>,
role: &'static str,
}
impl<S> RpcServiceT for Counter<S>
where
S: RpcServiceT + Send + Sync + Clone + 'static,
{
type MethodResponse = S::MethodResponse;
type NotificationResponse = S::NotificationResponse;
type BatchResponse = S::BatchResponse;
fn call<'a>(&self, req: Request<'a>) -> impl Future<Output = Self::MethodResponse> + Send + 'a {
let count = self.count.clone();
let service = self.service.clone();
let role = self.role;
async move {
let rp = service.call(req).await;
count.fetch_add(1, Ordering::SeqCst);
println!("{role} processed calls={} on the connection", count.load(Ordering::SeqCst));
rp
}
}
fn batch<'a>(&self, batch: Batch<'a>) -> impl Future<Output = Self::BatchResponse> + Send + 'a {
let len = batch.len();
self.count.fetch_add(len, Ordering::SeqCst);
println!("{} processed calls={} on the connection", self.role, self.count.load(Ordering::SeqCst));
self.service.batch(batch)
}
fn notification<'a>(&self, n: Notification<'a>) -> impl Future<Output = Self::NotificationResponse> + Send + 'a {
self.service.notification(n)
}
}In addition because this middleware is quite powerful it's possible to
modify requests and specifically the request ID which should be avoided
because it may break the response verification especially for the client-side.
See #1565 for further information.
There are also a couple of other changes see the detailed changelog below.
request timeout getter (#1533)ServerConfigBuilder::build (#1484)http request body log (#1540)Box<RawValue> (#1545)ServerConfigBuilder/ServerConfig replaces ServerBuilder duplicate setter methods (#1487)ProxyGetRequestLayer http middleware support multiple path-method pairs (#1492)Full Changelog: v0.24.9...v0.25.0
Nothing published for this version
Nothing published for this version
This is a non-breaking release that updates the dependency rust-platform-verifier to v0.5 to fix that that rust-platform-verifier v0.3 didn't enable t
This is a non-breaking release that updates the dependency rust-platform-verifier to v0.5 to fix that
that rust-platform-verifier v0.3 didn't enable the std feature in rustls which caused a compilation error.
See #1536 for further information.
Thanks to the external contributor @prestwich who spotted and fixed this issue.
This is a non-breaking release that decreases the MSRV to 1.74.0.
This is a non-breaking release that decreases the MSRV to 1.74.0.
Full Changelog: v0.24.7...v0.24.8
This is a patch release that mainly fixes the tower::Service implementation to be generic over the HttpBody to work with all middleware layers. For in
This is a patch release that mainly fixes the tower::Service implementation to be generic over the HttpBody to work with all middleware layers. For instance, this makes tower_http::compression::CompressionLayer work, which didn't compile before.
max_concurrent_requests (#1473)Full Changelog: v0.24.6...v0.24.7
This is a patch release that mainly fixes the tower::Service implementation to be generic over the HttpBody to work with all middleware layers.
For instance, this makes tower_http::compression::CompressionLayer work, which didn't compile before.
max_concurrent_requests (#1473)Thanks to the external contributor @hanabi1224 who contributed to this release.
This is a bug-fix release that fixes that the ConnectionGuard was dropped before the future was resolved which, could lead to that HTTP calls were not
This is a bug-fix release that fixes that the ConnectionGuard was dropped before the future was resolved which,
could lead to that HTTP calls were not counted correctly in the ConnectionGuard. This impacts only the server.
Full Changelog: v0.24.5...v0.24.6
This is a patch release that mainly fixes a compilation issue for the server because the feature tower/util was not enabled.
This is a patch release that mainly fixes a compilation issue for the server because the feature tower/util was not enabled.
http method_not_allowed message (#1452)Full Changelog: v0.24.4...v0.24.5
This is non-breaking release that changes the error variants to be thiserror(transparent) for wrapped errors and adds ConnectionGuard to the extension
This is non-breaking release that changes the error variants to be thiserror(transparent) for wrapped errors and adds ConnectionGuard to
the extensions to make it possible to get the number of active connections.
This is a small release that adds two new APIs to inject data via the extensions to the RpcModule/Methods and it only impacts users that are using Rpc
This is a small release that adds two new APIs to inject data via the extensions to the RpcModule/Methods
and it only impacts users that are using RpcModule directly via Methods::call/subscribe/raw_json_request (e.g., unit testing) and not the server itself.
Methods::extensions/extensions_mut (#1440)Another small release that fixes:
Another small release that fixes:
Thanks to the external contributor @DaniPopes who contributed to this release.
This is a small release that forces jsonrpsee rustls to use the crypto backend ring which may panic if both ring and aws-lc features are enabled. See
This is a small release that forces jsonrpsee rustls to use the crypto backend ring which may panic if both ring and aws-lc features are enabled.
See https://github.com/rustls/rustls/issues/1877 for further information.
This has no impact on the default configuration of jsonrpsee which was already using ring as the default.
A breaking release that mainly changes:
A breaking release that mainly changes:
tls feature for the client has been divided into tls and tls-platform-verifier where the tls feature
will only include rustls and no specific certificate store but the default one is still tls-rustls-platform-verifier.
This is useful if one wants to avoid bring on openssl dependencies.anyhow and beef from the codebase.This a small patch release that fixes a couple of bugs and adds a couple of new APIs.
This a small patch release that fixes a couple of bugs and adds a couple of new APIs.
The bug fixes are:
server::ws::on_connect was not working properly due to a merge nit when upgrading to hyper v1.0
This impacts only users that are using the low-level API and not the server itself.WsTransport::build_with_stream shouldn't not resolve the socket addresses and it's fixed now, see #1411 for further info.
This impacts users that are inject their own TcpStream directly into the WsTransport.RpcModule::remove (#1416)capacity and max_capacity to the subscription API (#1414)PendingSubscriptionSink::method_name (#1413)This is a patch release that injects the ConnectionId in the extensions when using a RpcModule without a server. This impacts users that are using Rpc
This is a patch release that injects the ConnectionId in the extensions when using a RpcModule without a server. This impacts users that are using RpcModule directly (e.g., unit testing) and not the server itself.
This is a new breaking release, and let's go through the changes.
This is a new breaking release, and let's go through the changes.
jsonrpsee has been upgraded to use hyper v1.0 and this mainly impacts users that are using
the low-level API and rely on the hyper::service::make_service_fn
which has been removed, and from now on you need to manage the socket yourself.
The hyper::service::make_service_fn can be replaced by the following example template:
async fn start_server() {
let listener = tokio::net::TcpListener::bind("127.0.0.1:0").await.unwrap();
loop {
let sock = tokio::select! {
res = listener.accept() => {
match res {
Ok((stream, _remote_addr)) => stream,
Err(e) => {
tracing::error!("failed to accept v4 connection: {:?}", e);
continue;
}
}
}
_ = per_conn.stop_handle.clone().shutdown() => break,
};
let svc = tower::service_fn(move |req: hyper::Request<hyper::body::Incoming>| {
let mut jsonrpsee_svc = svc_builder
.set_rpc_middleware(rpc_middleware)
.build(methods, stop_handle);
// https://github.com/rust-lang/rust/issues/102211 the error type can't be inferred
// to be `Box<dyn std::error::Error + Send + Sync>` so we need to convert it to a concrete type
// as workaround.
jsonrpsee_svc
.call(req)
.await
.map_err(|e| anyhow::anyhow!("{:?}", e))
});
tokio::spawn(jsonrpsee::server::serve_with_graceful_shutdown(
sock,
svc,
stop_handle.clone().shutdown(),
));
}
}
Also, be aware that tower::service_fn and hyper::service::service_fn are different and it's recommended to use tower::service_fn from now.
Because it was not possible/easy to share state between RPC middleware layers
jsonrpsee has added Extensions to the Request and Response.
To allow users to inject arbitrary data that can be accessed in the RPC middleware
and RPC handlers.
Please be careful when injecting large amounts of data into the extensions because It's cloned for each RPC call, which can increase memory usage significantly.
The connection ID from the jsonrpsee-server is injected in the extensions by default. and it is possible to fetch it as follows:
struct LogConnectionId<S>(S);
impl<'a, S: RpcServiceT<'a>> RpcServiceT<'a> for LogConnectionId<S> {
type Future = S::Future;
fn call(&self, request: jsonrpsee::types::Request<'a>) -> Self::Future {
let conn_id = request.extensions().get::<ConnectionId>().unwrap();
tracing::info!("Connection ID {}", conn_id.0);
self.0.call(request)
}
}
In addition the Extensions is not added in the proc-macro API by default and
one has to enable with_extensions attr for that to be available:
#[rpc(client, server)]
pub trait Rpc {
// legacy
#[method(name = "foo"])
async fn async_method(&self) -> u16>;
// with extensions
#[method(name = "with_ext", with_extensions)]
async fn f(&self) -> bool;
}
impl RpcServer for () {
async fn async_method(&self) -> u16 {
12
}
// NOTE: ext is injected just after self in the API
async fn f(&self, ext: &Extensions: b: String) -> {
ext.get::<u32>().is_ok()
}
}
The default TLS certificate store has been changed to
rustls-platform-verifier to decide the best certificate
store for each platform.
In addition it's now possible to inject a custom certificate store if one wants need some special certificate store.
The subscription API has been modified:
serde_json::Error
to indicate that error can only occur if the decoding of T fails.Subscription::close_reason after the subscription closed (i.e. has return None) to know why.If one wants to replace old messages in case of lagging it is recommended to write your own adaptor on top of the subscription:
fn drop_oldest_when_lagging<T: Clone + DeserializeOwned + Send + Sync + 'static>(
mut sub: Subscription<T>,
buffer_size: usize,
) -> impl Stream<Item = Result<T, BroadcastStreamRecvError>> {
let (tx, rx) = tokio::sync::broadcast::channel(buffer_size);
tokio::spawn(async move {
// Poll the subscription which ignores errors
while let Some(n) = sub.next().await {
let msg = match n {
Ok(msg) => msg,
Err(e) => {
tracing::error!("Failed to decode the subscription message: {e}");
continue;
}
};
// Only fails if the receiver has been dropped
if tx.send(msg).is_err() {
return;
}
}
});
BroadcastStream::new(rx)
}
serve and serve_with_graceful_shutdown helpers (#1382)extensions from http layer (#1389)with_extensions (#1380)Extensions to Request/MethodResponse (#1306)Subscription::close_reason (#1320)ConnectionId in subscription APIs (#1392)ws ping/pong (#1386)authorization header from the URL (#1384)A small bug-fix release, see each commit below for further information.
A small bug-fix release, see each commit below for further information.
Yet another rather small release that fixes a cancel-safety issue that could cause an unexpected panic when reading disconnect reason from the backgro
Yet another rather small release that fixes a cancel-safety issue that could cause an unexpected panic when reading disconnect reason from the background task.
Also this makes the API Client::disconnect_reason cancel-safe.
Another small release that adds a new API for RpcModule if one already has the state in an Arc and a couple of bug fixes.
Another small release that adds a new API for RpcModule if one already has the state in an Arc
and a couple of bug fixes.
RpcModule::from_arc (#1324)AlreadyStoppedError (#1325)Thanks to the external contributors @mattsse and @aatifsyed who contributed to this release.
This is a small patch release that exposes the connection details in server method implementations without breaking changes. We plan to extend this fu…
This is a small patch release that exposes the connection details in server method implementations without breaking changes. We plan to extend this functionality in jsonrpsee v1.0, although this will necessitate a breaking change.
This is a small patch release that internally changes AtomicU64 to AtomicUsize to support more targets.
This is a small patch release that internally changes AtomicU64 to AtomicUsize
to support more targets.
Another breaking release where a new ResponsePayload type is introduced in order to make it possible to determine whether a response has been processe
Another breaking release where a new ResponsePayload type is introduced in order
to make it possible to determine whether a response has been processed.
Unfortunately, the IntoResponse trait was modified to enable that
and some minor changes were made to make more fields private to avoid further
breakage.
ResponsePayload API#[rpc(server)]
pub trait Api {
#[method(name = "x")]
fn x(&self) -> ResponsePayload<'static, String>;
}
impl RpcServer for () {
fn x(&self) -> ResponsePayload<'static, String> {
let (rp, rp_done) = ResponsePayload::success("ehheeheh".to_string()).notify_on_completion();
tokio::spawn(async move {
if rp_done.await.is_ok() {
do_task_that_depend_x();
}
});
rp
}
}
We are getting closer to releasing jsonrpsee v1.0 and the following work is planned:
Thanks to the external contributor @dan-starkware who contributed to this release.
TowerService::on_session_close (#1284)Response has been processed. (#1281)This release contains big changes and let's go over the main ones:
This release contains big changes and let's go over the main ones:
After getting plenty of feedback regarding a JSON-RPC specific middleware,
this release introduces a composable "tower-like" middleware that applies per JSON-RPC method call.
The new middleware also replaces the old RpcLogger which may break some use-cases, such as if
JSON-RPC was made on a WebSocket or HTTP transport, but it's possible to implement that by
using jsonrpsee as a tower service or the low-level server API.
An example how write such middleware:
#[derive(Clone)]
pub struct ModifyRequestIf<S>(S);
impl<'a, S> RpcServiceT<'a> for ModifyRequestIf<S>
where
S: Send + Sync + RpcServiceT<'a>,
{
type Future = S::Future;
fn call(&self, mut req: Request<'a>) -> Self::Future {
// Example how to modify the params in the call.
if req.method == "say_hello" {
// It's a bit awkward to create new params in the request
// but this shows how to do it.
let raw_value = serde_json::value::to_raw_value("myparams").unwrap();
req.params = Some(StdCow::Owned(raw_value));
}
// Re-direct all calls that isn't `say_hello` to `say_goodbye`
else if req.method != "say_hello" {
req.method = "say_goodbye".into();
}
self.0.call(req)
}
}
async fn run_server() {
// Construct our middleware and build the server.
let rpc_middleware = RpcServiceBuilder::new().layer_fn(|service| ModifyRequestIf(service));
let server = Server::builder().set_rpc_middleware(rpc_middleware).build("127.0.0.1:0").await.unwrap();
// Start the server.
let mut module = RpcModule::new(());
module.register_method("say_hello", |_, _| "lo").unwrap();
module.register_method("say_goodbye", |_, _| "goodbye").unwrap();
let handle = server.start(module);
handle.stopped().await;
}
For users who want to get full control of the HTTP request, it's now possible to utilize jsonrpsee as a tower service example here
For users who want to get low-level access and for example to disconnect misbehaving peers that is now possible as well example here
Logging of RPC calls has been disabled by default, but it's possible to enable that with the RPC logger middleware or provide your own middleware for that.
let rpc_middleware = RpcServiceBuilder::new().rpc_logger(1024);
let server = Server::builder().set_rpc_middleware(rpc_middleware).build("127.0.0.1:0").await?;
The WebSocket ping/pong APIs have been refactored to be able to disconnect inactive connections both by from the server and client-side.
Thanks to the external contributors @oleonardolima and @venugopv who contributed to this release.
tcp_nodelay == true by default ([#1263])(https://github.com/paritytech/jsonrpsee/pull/1263)disconnect_reason API (#1246)service and low-level API for more fine-grained API to disconnect peers etc (#1224)HostFilterLayer::disable (#1213)Nothing published for this version
This release fixes a cancel-safety issue in the server's graceful shutdown which could lead to high CPU usage.
This release fixes a cancel-safety issue in the server's graceful shutdown which could lead to high CPU usage.
This release removes the bounded buffer check which was intended to provide backpressure all the way down to the TCP layer but it didn't work well.
This release removes the bounded buffer check which was intended to provide backpressure all the way down to the TCP layer but it didn't work well.
For subscriptions the backpressure will be handled by implementation itself and just rely on that.
This release adds support for synchronous subscriptions and fixes a leak in WebSocket server where FuturesUnordered was not getting polled until shutd
This release adds support for synchronous subscriptions and fixes a leak in WebSocket server
where FuturesUnordered was not getting polled until shutdown, so it was accumulating tasks forever.
register_subscription_raw (#1182)Another breaking release where the major changes are:
Another breaking release where the major changes are:
host filtering has been moved to tower middleware instead of the server API.wss://my.server.comRegarding host filtering prior to this release one had to do:
let acl = AllowHosts::Only(vec!["http://localhost:*".into(), "http://127.0.0.1:*".into()]);
let server = ServerBuilder::default().set_host_filtering(acl).build("127.0.0.1:0").await.unwrap();
After this release then one have to do:
let middleware = tower::ServiceBuilder::new().layer(HostFilterLayer::new(["example.com"]).unwrap());
let server = Server::builder().set_middleware(middleware).build("127.0.0.1:0".parse::<SocketAddr>()?).await?;
Thanks to the external contributors @polachok, @bobs4462 and @aj3n that contributed to this release.
SubscriptionMessage::new (#1176)SubscriptionSink::connection_id (#1175)Params::get (#1173)PendingSubscriptionSink::connection_id (#1163)&str (#1160)RootCertStore::add_trust_anchors (#1165)Fixed connections processing await on server shutdown
This release improves error message for too big batch response and exposes the BatchRequestConfig type in order to make it possible to use ServerBuild
This release fixes a couple bugs and improves the ergonomics for the HTTP client when no tower middleware is enabled.
This release fixes a couple bugs and improves the ergonomics for the HTTP client when no tower middleware is enabled.
This is a breaking release that removes the CallError which was used to represent a JSON-RPC error object that could happen during JSON-RPC method cal
This is a breaking release that removes the CallError which was used to represent a JSON-RPC error object that
could happen during JSON-RPC method call and one could assign application specific error code, message and data in a
specific implementation.
Previously jsonrpsee provided CallError that could be converted to/from jsonrpsee::core::Error
and in some scenarios the error code was automatically assigned by jsonrpsee. After jsonrpsee
added support for custom error types the CallError doesn't provide any benefit because one has to implement Into<ErrorObjectOwned>
on the error type anyway.
Thus, jsonrpsee::core::Error can't be used in the proc macro API anymore and the type alias
RpcResult has been modified to Result<(), ErrorObjectOwned> instead.
Before it was possible to do:
#[derive(thiserror::Error)]
enum Error {
A,
B,
}
#[rpc(server, client)]
pub trait Rpc
{
#[method(name = "getKeys")]
async fn keys(&self) -> Result<String, jsonrpsee::core::Error> {
Err(jsonrpsee::core::Error::to_call_error(Error::A))
// or jsonrpsee::core::Error::Call(CallError::Custom(ErrorObject::owned(1, "a", None::<()>)))
}
}
After this change one has to do:
pub enum Error {
A,
B,
}
impl From<Error> for ErrorObjectOwned {
fn from(e: Error) -> Self {
match e {
Error::A => ErrorObject::owned(1, "a", None::<()>),
Error::B => ErrorObject::owned(2, "b", None::<()>),
}
}
}
#[rpc(server, client)]
pub trait Rpc {
// Use a custom error type that implements `Into<ErrorObject>`
#[method(name = "custom_err_ty")]
async fn custom_err_type(&self) -> Result<String, Error> {
Err(Error::A)
}
// Use `ErrorObject` as error type directly.
#[method(name = "err_obj")]
async fn error_obj(&self) -> RpcResult<String> {
Err(ErrorObjectOwned::owned(1, "c", None::<()>))
}
}
CallError (#1087)This release fixes HTTP graceful shutdown for the server.
This release fixes HTTP graceful shutdown for the server.
This is a significant release and the major breaking changes to be aware of are:
This is a significant release and the major breaking changes to be aware of are:
This release changes the server to be "backpressured" and it mostly concerns subscriptions.
New APIs has been introduced because of that and the API pipe_from_stream has been removed.
Before it was possible to do:
module
.register_subscription("sub", "s", "unsub", |_, sink, _| async move {
let stream = stream_of_integers();
tokio::spawn(async move {
sink.pipe_from_stream(stream)
});
})
.unwrap();
After this release one must do something like:
// This is just a example helper.
//
// Other examples:
// - <https://github.com/paritytech/jsonrpsee/blob/master/examples/examples/ws_pubsub_broadcast.rs>
// - <https://github.com/paritytech/jsonrpsee/blob/master/examples/examples/ws_pubsub_with_params.rs>
async fn pipe_from_stream<T: Serialize>(
pending: PendingSubscriptionSink,
mut stream: impl Stream<Item = T> + Unpin,
) -> Result<(), anyhow::Error> {
let mut sink = pending.accept().await?;
loop {
tokio::select! {
_ = sink.closed() => break Ok(()),
maybe_item = stream.next() => {
let Some(item) = match maybe_item else {
break Ok(()),
};
let msg = SubscriptionMessage::from_json(&item)?;
if let Err(e) = sink.send_timeout(msg, Duration::from_secs(60)).await {
match e {
// The subscription or connection was closed.
SendTimeoutError::Closed(_) => break Ok(()),
/// The subscription send timeout expired
/// the message is returned and you could save that message
/// and retry again later.
SendTimeoutError::Timeout(_) => break Err(anyhow::anyhow!("Subscription timeout expired")),
}
}
}
}
}
}
module
.register_subscription("sub", "s", "unsub", |_, pending, _, _| async move {
let stream = stream();
pipe_from_stream(sink, stream).await
})
.unwrap();
This release also introduces a trait called IntoResponse which is makes it possible to return custom types and/or error
types instead of enforcing everything to return Result<T, jsonrpsee::core::Error>
This affects the APIs RpcModule::register_method, RpcModule::register_async_method and RpcModule::register_blocking_method
and when these are used in the proc macro API are affected by this change.
Be aware that the client APIs don't support this yet
The IntoResponse trait is already implemented for Result<T, jsonrpsee::core::Error> and for the primitive types
Before it was possible to do:
// This would return Result<&str, jsonrpsee::core::Error>
module.register_method("say_hello", |_, _| Ok("lo"))?;
After this release it's possible to do:
// Note, this method call is infallible and you might not want to return Result.
module.register_method("say_hello", |_, _| "lo")?;
jsonrpsee now spawns the subscriptions via tokio::spawn and it's sufficient to provide an async block in register_subscription
Further, the subscription API had an explicit close API for closing subscriptions which was hard to understand and to get right. This has been removed and everything is handled by the return value/type of the async block instead.
Example:
module
.register_subscription::<RpcResult<(), _, _>::("sub", "s", "unsub", |_, pending, _, _| async move {
// This just answers the RPC call and if this fails => no close notification is sent out.
pending.accept().await?;
// This is sent out as a `close notification/message`.
Err(anyhow::anyhow!("The subscription failed"))?;
})
.unwrap();
The return value in the example above needs to implement IntoSubscriptionCloseResponse and
any value that is returned after that the subscription has been accepted will be treated as a IntoSubscriptionCloseResponse.
Because Result<(), E> is used here the close notification will be sent out as error notification but it's possible to
disable the subscription close response by using () instead of Result<(), E> or implement IntoSubscriptionCloseResponse for other behaviour.
Semaphore::(u32::MAX) (#1051)max_log_length APIs and use missing configs (#956)impl IntoSubscriptionResponse (#1034)IntoResponse trait for method calls (#1057)jsonrpc protocol version field in Response as Option (#1046)SubscriptionAnswer (#1025)max_notifs_per_subscription to max_buffer_capacity_per_subscription (#1012)FutureDriver with tokio::spawn (#1080)Nothing published for this version
This release adds Clone and Copy implementations.
v0.16.1 is release that adds two new APIs to server http_only and ws_only to make it possible to allow only HTTP respectively WebSocket.
v0.16.1 is release that adds two new APIs to server http_only and ws_only to make it possible to allow only HTTP respectively WebSocket.
Both HTTP and WebSocket are still enabled by default.
async-channel (#940)v0.16.0 is a breaking release and the major changes are:
v0.16.0 is a breaking release and the major changes are:
jsonrpsee-http-server and jsonrpsee-ws-server crates are moved to the jsonrpsee-server crate instead.tower middleware support.tower middleware.types to server feature (#891)RpcModule::call decode response correctly (#839)transport protocol details to the logger trait (#886)notify_on_disconnect (#837)bytes_len() to Params (#848)WS and HTTP servers with a server that supports both WS and HTTP (#863)tower support (#831)Middleware to Logger (#845)SubscriptionSink::pipe_from_stream (#901)This release fixes some incorrect tracing spans.
This release fixes some incorrect tracing spans.
v0.15.0 is a breaking release. The main changes are:
v0.15.0 is a breaking release. The main changes are:
examples/examples/proc_macro_bounds.rs for examples.PendingSink concept (you can still manually accept or reject a sink, but otherwise it'll be accepted automatically if you send a message down it) (#799).Middleware trait has been split into HttpMiddleware and WsMiddleware to better capture the differences between the two. if you use custom middleware, you'll need to implement one or the other trait on it depending on your used transport method (#793). We also provide params and the method type to middleware calls now, too (#820).Here's the full list of changes:
v0.14.0 is breaking release which changes the health and access control APIs and a bunch of bug fixes.
v0.14.0 is breaking release which changes the health and access control APIs and a bunch of bug fixes.
* in host and origin filtering #781unsubscribe calls in middleware #792fn call #774ping-pong for WebSocket clients #772ping-pong for WebSocket server #782v0.13.1 is a release that fixes the documentation for feature-gated items on docs.rs.
v0.13.0 is release that adds health API support for the HTTP server and a few bug fixes.
v0.12.0 is mainly a patch release with some minor features added.
v0.12.0 is mainly a patch release with some minor features added.
unsubscribed via the unsubscribe call #743v0.11.0 is a breaking release that reworks how subscriptions are handled by the servers where the users have to explicitly reject or accept each subsc
v0.11.0 is a breaking release that reworks how subscriptions are handled by the servers where the users have to explicitly reject or accept each subscription. The reason for this is that the actual params in the subscription is passed to the callback and if the application decides the params are invalid and the server can't know if the call is going to fail or pass when dispatching the call. Thus, the actual subscription method call is only answered when the subscription is accepted or rejected.
Additionally, the servers before sent a SubscriptionClosed message which is now disabled by default because it might break other implementations.
It is still possible to respond with a SubscriptionClosed message but one has to match on the result from SubscriptionSink::pipe_from_stream.
This release also adds support for JSON-RPC WASM client using web-sys bindings.
v0.10.1 is a release that fixes a regression in the HTTP server where the backlog was hardcoded to 128 (this is now set to 1024 by default but also co
v0.10.1 is a release that fixes a regression in the HTTP server where the backlog was hardcoded to 128 (this is now set to 1024 by default but also configurable), introduces a couple of new APIs and a few minor bug fixes.
If your usage expects a high rate of new HTTP connections you are encouraged to update or manually configure the socket based on the traffic characteristics.
Error::Request variant #717SubscriptionClosed notification #721ws server #703Yanked due to a leak when closing subscriptions in WebSocket server.
Yanked due to a leak when closing subscriptions in WebSocket server.
v0.9.0 is technically a breaking release because of the Debug bound of the IdProvider trait changed which is used by WebSocket server. In practise it
v0.9.0 is technically a breaking release because of the Debug bound of the IdProvider trait changed which is used by WebSocket server. In practise it should be a non-breaking upgrade for most users.
refactor(ws server): impl IdProvider for Box<T> #684 chore(deps): update parking_lot requirement from 0.11 to 0.12 #682
v0.8.0 is a breaking release for the way subscription closing is handled, along with a few other minor tweaks and fixes.
v0.8.0 is a breaking release for the way subscription closing is handled, along with a few other minor tweaks and fixes.
v0.7.0 is a breaking release that contains a big refactoring of the crate structure. The types and utils crates are split up as types and core to clar
v0.7.0 is a breaking release that contains a big refactoring of the crate structure. The types and
utils crates are split up as types and core to clarify the difference between the two.
core: common types used in various places.
types: includes JSON-RPC specification related types.
SubscriptionClosed #612palaver crate in an example #597FxHashMap instead FnvHashMap #592tls #545tracing-subscriber #615_ #611Your coding agent can read these notes before it upgrades. Set up the MCP server →