From 72939a92312b65352fbb76b588e3aff6cb45615b Mon Sep 17 00:00:00 2001 From: Niklas Adolfsson Date: Wed, 7 Feb 2024 16:28:20 +0100 Subject: [PATCH] chore: release v0.22.0 (#1285) * chore: release v0.22.0 * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md * make some small tweaks * Update CHANGELOG.md * Update CHANGELOG.md * Update CHANGELOG.md --- CHANGELOG.md | 60 +++++++++++++++++++++++++++++++++++--- Cargo.toml | 18 ++++++------ server/src/transport/ws.rs | 12 ++++---- 3 files changed, 71 insertions(+), 19 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8a17d70bd9..6a3a0a4772 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,58 @@ The format is based on [Keep a Changelog]. [Keep a Changelog]: http://keepachangelog.com/en/1.0.0/ +## [v0.22.0] - 2024-02-07 + +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. + +### Example of the async `ResponsePayload API` + +```rust +#[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 + } +} +``` + +### Roadmap + +We are getting closer to releasing jsonrpsee v1.0 and +the following work is planned: +- Native async traits +- Upgrade hyper to v1.0 +- Better subscription API for the client. + +Thanks to the external contributor [@dan-starkware](https://github.com/dan-starkware) who contributed to this release. + +### [Added] +- feat(server): add `TowerService::on_session_close` ([#1284](https://github.com/paritytech/jsonrpsee/pull/1284)) +- feat(server): async API when `Response` has been processed. ([#1281](https://github.com/paritytech/jsonrpsee/pull/1281)) + +### [Changed] +- client(error): make display impl less verbose ([#1283](https://github.com/paritytech/jsonrpsee/pull/1283)) +- fix: allow application/json-rpc http content type ([#1277](https://github.com/paritytech/jsonrpsee/pull/1277)) +- refactor(rpc_module): RpcModule::raw_json_request -> String ([#1287](https://github.com/paritytech/jsonrpsee/pull/1287)) + ## [v0.21.0] - 2023-12-13 This release contains big changes and let's go over the main ones: @@ -72,7 +124,7 @@ misbehaving peers that is now possible as well [example here](./examples/example ### Logging in the server -Logging of RPC calls has been disabled by default, +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. @@ -83,10 +135,10 @@ let server = Server::builder().set_rpc_middleware(rpc_middleware).build("127.0.0 ### WebSocket ping/pong API -The WebSocket ping/pong APIs have been refactored to be able +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](https://github.com/oleonardolima) +Thanks to the external contributors [@oleonardolima](https://github.com/oleonardolima) and [@venugopv](https://github.com/venugopv) who contributed to this release. ### [Changed] @@ -126,7 +178,7 @@ This release fixes a cancel-safety issue in the server's graceful shutdown which 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 +For subscriptions the backpressure will be handled by implementation itself and just rely on that. ### [Changed] diff --git a/Cargo.toml b/Cargo.toml index 89c1ae1cba..786d879e1d 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ resolver = "2" [workspace.package] authors = ["Parity Technologies ", "Pierre Krieger "] -version = "0.21.0" +version = "0.22.0" edition = "2021" rust-version = "1.64.0" license = "MIT" @@ -30,11 +30,11 @@ keywords = ["jsonrpc", "json", "http", "websocket", "WASM"] readme = "README.md" [workspace.dependencies] -jsonrpsee-types = { path = "types", version = "0.21.0" } -jsonrpsee-core = { path = "core", version = "0.21.0" } -jsonrpsee-server = { path = "server", version = "0.21.0" } -jsonrpsee-ws-client = { path = "client/ws-client", version = "0.21.0" } -jsonrpsee-http-client = { path = "client/http-client", version = "0.21.0" } -jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.21.0" } -jsonrpsee-client-transport = { path = "client/transport", version = "0.21.0" } -jsonrpsee-proc-macros = { path = "proc-macros", version = "0.21.0" } +jsonrpsee-types = { path = "types", version = "0.22.0" } +jsonrpsee-core = { path = "core", version = "0.22.0" } +jsonrpsee-server = { path = "server", version = "0.22.0" } +jsonrpsee-ws-client = { path = "client/ws-client", version = "0.22.0" } +jsonrpsee-http-client = { path = "client/http-client", version = "0.22.0" } +jsonrpsee-wasm-client = { path = "client/wasm-client", version = "0.22.0" } +jsonrpsee-client-transport = { path = "client/transport", version = "0.22.0" } +jsonrpsee-proc-macros = { path = "proc-macros", version = "0.22.0" } diff --git a/server/src/transport/ws.rs b/server/src/transport/ws.rs index 4d843a51c3..c93aee67c8 100644 --- a/server/src/transport/ws.rs +++ b/server/src/transport/ws.rs @@ -355,16 +355,16 @@ async fn graceful_shutdown( _ = send_task_handle.await; } -/// Low-level API that attempts to establish WebSocket connection +/// Low-level API that tries to upgrade the HTTP connection to a WebSocket connection. /// -/// Returns Ok((http_response, fut)) if websocket connection was successfully established -/// otherwise Err(http_response). +/// Returns `Ok((http_response, conn_fut))` if the WebSocket connection was successfully established +/// otherwise `Err(http_response)`. /// -/// `fut` is a future that drives the WebSocket connection +/// `conn_fut` is a future that drives the WebSocket connection /// and if it's dropped the connection will be closed. /// -/// If you calling this from the `hyper::service_fn` the HTTP response -/// must be sent back and the websocket connection will held in another task. +/// Because this API depends on [`hyper`] the response needs to be sent +/// to complete the HTTP request. /// /// ```no_run /// use jsonrpsee_server::{ws, ServerConfig, Methods, ConnectionState};