JetStream
JetStream is an RPC framework built on top of s2n-quic, iroh, and p9. It's designed to be a high performance, low latency, secure, and reliable RPC framework.
Features:
For detailed API documentation, see the rustdoc documentation.
Examples
- echo - Basic QUIC-based echo service example
- iroh_echo - Echo service using iroh transport
- wasm_example - WebAssembly example
- wasm_example_bindings - WebAssembly bindings example
Changelog
9.5.0 (2025-10-30)
Features
- add cleanup code serverside. add cloudflare docs to mdbook (91da99c)
- introduce jetstream cloudflare module. (6e8cc01)
Bug Fixes
- add comment about cf exec model (c979856)
- remove tracing from sink and stream (97ac0a5)
- remove unsafe code (a286d93)
9.4.2 (2025-10-28)
Bug Fixes
- dependency sudoku (7df5f9b)
9.4.1 (2025-10-17)
Bug Fixes
9.4.0 (2025-10-15)
Features
- add context (4771c84)
Bug Fixes
- cargo toml version issues (3481015)
- collections can only be u16::MAX (6ada71a)
- recursive self call (c51d455)
- wasm32 feature gates (755f9c1)
9.3.0 (2025-10-14)
Features
- add tracing feature (5cb2907)
9.2.0 (2025-10-05)
Features
- dt features, remove rustdoc_to_md_book (0398159)
Bug Fixes
9.1.2 (2025-10-05)
Bug Fixes
- failing docs (232ddee)
9.1.1 (2025-10-05)
Bug Fixes
9.1.0 (2025-10-02)
Features
- introduce iroh examples (86e001f)
Bug Fixes
- add support for libc in windows and mac (1fb3b5b)
- disable running echo on windows (828d6be)
- disable running echo on windows (7f44956)
9.0.0 (2025-09-29)
β BREAKING CHANGES
- move quic and webocket to their own crates.
Features
- move quic and webocket to their own crates. (7d0ba9f)
Bug Fixes
- simpler workflows for github actions (17185dd)
8.3.1 (2025-06-06)
Bug Fixes
- update docs (74e2867)
8.3.0 (2025-05-31)
Features
- jetstream_libc (aba123b)
8.2.1 (2025-05-29)
Bug Fixes
- rustdoc to mdbook (2098ad1)
8.2.0 (2025-05-29)
Features
- jetstream distributed features (52b5e89)
Bug Fixes
- Update lib.rs for extern crates (ffb6777)
8.1.5 (2025-04-05)
Bug Fixes
8.1.4 (2025-04-04)
Bug Fixes
8.1.3 (2025-04-04)
Bug Fixes
8.1.2 (2025-02-15)
Bug Fixes
- make websocket pub again (21acf4b)
8.1.1 (2025-02-15)
Bug Fixes
- make websocket pub (6096ff9)
8.1.0 (2025-02-15)
Features
8.0.10 (2025-02-14)
Bug Fixes
- broken lock file (6148cf7)
8.0.9 (2025-02-14)
Bug Fixes
- remove prost (5a5ff9b)
8.0.8 (2025-02-01)
Bug Fixes
- remove expects (8a58cf5)
8.0.7 (2025-01-30)
Bug Fixes
- release please (53a698b)
8.0.6 (2025-01-30)
Bug Fixes
8.0.5 (2025-01-30)
Bug Fixes
- use cargo publish workspace (e28a0f7)
8.0.4 (2025-01-30)
Bug Fixes
- dependency order and cycle (6a6c997)
- formatting (049e584)
- reexport tokio_util from rpc (cf28c40)
- rust.yml workflow (9dc7bc0)
8.0.3 (2025-01-30)
Bug Fixes
8.0.2 (2025-01-30)
Bug Fixes
- criterion benchmark test, framed implementation (25b1611)
- failing serde tests (81db0de)
- reenable sccache (757bb7e)
- service macro works correctly with client calls (eb1fd0f)
- snapshots for macros (fab686d)
8.0.1 (2025-01-28)
Bug Fixes
- remove distributed (3aba1f6)
8.0.0 (2025-01-27)
β BREAKING CHANGES
- use more futures
Features
- use more futures (467b6f5)
Bug Fixes
- formatting (04aace4)
7.4.0 (2025-01-18)
Features
- jetstream_rpc supports wasm (e97e6ca)
7.3.0 (2025-01-17)
Features
7.2.1 (2024-12-10)
Bug Fixes
- keep reciver types as is in generated code (7d95671)
7.2.0 (2024-12-09)
Features
- Ip primitives (1c263b5)
7.1.2 (2024-12-06)
Bug Fixes
- elide lifetimes in ufs (b778ff9)
7.1.1 (2024-11-25)
Bug Fixes
- broken use statement for async_trait (cce4df6)
7.1.0 (2024-11-25)
Features
- added async_trait support service macro (9a86185)
7.0.4 (2024-11-23)
Bug Fixes
- fuzz target (a494e15)
7.0.3 (2024-11-21)
Bug Fixes
7.0.1 (2024-11-21)
Bug Fixes
7.0.0 (2024-11-21)
β BREAKING CHANGES
- fix proken publish
Features
- fix proken publish (a7272c0)
6.6.2 (2024-11-21)
Bug Fixes
- bump okid (7ed2940)
6.6.1 (2024-11-20)
Bug Fixes
- broken okid lockfile (63bae5e)
6.6.0 (2024-11-20)
Features
Bug Fixes
6.5.0 (2024-11-20)
Features
Bug Fixes
6.4.2 (2024-11-18)
Bug Fixes
- bump deps (0dbd81b)
6.4.1 (2024-11-11)
Bug Fixes
- make the proto mod same vis as trait (a43c0a2)
6.4.0 (2024-11-10)
Features
Bug Fixes
6.3.4 (2024-11-10)
Bug Fixes
- make qid eq,hash (522de0d)
6.3.3 (2024-11-10)
Bug Fixes
- update 9p to use trait_variant (96db410)
6.3.2 (2024-11-10)
Bug Fixes
- option<T> support (2e224ca)
6.3.1 (2024-11-09)
Bug Fixes
- ci workflows (4c12f04)
6.3.0 (2024-11-09)
Features
Bug Fixes
- remove jj (02fefd9)
6.2.0 (2024-11-08)
Features
- add i16,i32,i64,i128 types (3f0751a)
6.1.0 (2024-11-08)
Features
6.0.2 (2024-11-08)
Bug Fixes
6.0.1 (2024-11-08)
Bug Fixes
6.0.0 (2024-11-07)
β BREAKING CHANGES
- splits up packages
- move modules to sensible parents
- protocol -> coding
- merge all the creates
Features
- autopub (73a0844)
- hide filesystem behind a feautre-flag (9aa880d)
- macros: service macro to remove boilerplate code (e0a9295)
- modularize components (7262a66)
- release please (7d7bedd)
- release please (044cceb)
- revamp service (#147) (6d96be8)
- rust-clippy code scanning (3dfb39f)
- use sccache (#142) (89f96ab)
- use serde_bytes::ByteBuf instead of Bytes (a1101d9)
- virtio support (ce13217)
- wireformat: add u128 (c76f6c4)
Bug Fixes
- auto-release (964036c)
- auto-release feature (6505b0f)
- bothced update (b3b7003)
- broken release-please (089bb22)
- bump zero copy (#140) (4bb933f)
- ci release-please (de391e5)
- filesystem under feature flag, rm newline (de4cf79)
- ignore e2e tests (e066dde)
- lint errors (4f50d0b)
- macros: protocol macro fix to spread fn args (b261a28)
- make data io::Read (12a864e)
- make data io::Read (910c75a)
- make data io::Read (77b3680)
- readme (dc77722)
- release again (3a6e65e)
- release workflow (4abeb24)
- revert serde_bytes to bytes with serde (2e02460)
- unused git (3fe908e)
- Update client_tests.rs (4c50132)
- update release flow (#144) (36dd4af)
- Update release.yml (b058b38)
- Update release.yml (#122) (566fe1f)
- update to v2 upload sarif (e38bacb)
- version (822bf0e)
- warnings (62d8013)
- wireformat: from_bytes doesn't require a mutable buf (437c35c)
Code Refactoring
- merge all the creates (faa0a1a)
- move modules to sensible parents (4eba5fb)
- protocol -> coding (5f86bc7)
5.4.2 (2024-11-07)
Bug Fixes
- auto-release (964036c)
5.4.2 (2024-11-07)
Bug Fixes
- auto-release (964036c)
5.4.1 (2024-11-07)
Bug Fixes
- readme (dc77722)
5.4.0 (2024-11-07)
Features
5.3.0 (2024-10-23)
Features
Bug Fixes
5.2.3 (2024-10-10)
Bug Fixes
5.2.2 (2024-10-07)
Bug Fixes
- revert serde_bytes to bytes with serde (2e02460)
5.2.1 (2024-10-06)
Bug Fixes
- wireformat: from_bytes doesn't require a mutable buf (437c35c)
5.2.0 (2024-10-06)
Features
- use serde_bytes::ByteBuf instead of Bytes (a1101d9)
Bug Fixes
- lint errors (4f50d0b)
5.1.4 (2024-10-03)
Bug Fixes
- lint errors (4f50d0b)
5.1.3 (2024-10-03)
Bug Fixes
- Update release.yml (b058b38)
5.1.2 (2024-10-03)
Bug Fixes
5.1.1 (2024-10-03)
Bug Fixes
5.1.0 (2024-10-03)
Features
- wireformat: add u128 (c76f6c4)
Bug Fixes
- release workflow (4abeb24)
5.0.0 (2024-10-03)
β BREAKING CHANGES
- splits up packages
Features
- modularize components (7262a66)
Bug Fixes
- version (822bf0e)
4.0.0 (2024-10-01)
β BREAKING CHANGES
- move modules to sensible parents
Code Refactoring
- move modules to sensible parents (4eba5fb)
3.0.0 (2024-03-30)
β BREAKING CHANGES
- protocol -> coding
- merge all the creates
Features
- autopub (73a0844)
- hide filesystem behind a feautre-flag (9aa880d)
- macros: service macro to remove boilerplate code (e0a9295)
- release please (7d7bedd)
- release please (044cceb)
- rust-clippy code scanning (3dfb39f)
- virtio support (ce13217)
Bug Fixes
- auto-release feature (6505b0f)
- bothced update (b3b7003)
- broken release-please (089bb22)
- ci release-please (de391e5)
- filesystem under feature flag, rm newline (de4cf79)
- ignore e2e tests (e066dde)
- macros: protocol macro fix to spread fn args (b261a28)
- make data io::Read (12a864e)
- make data io::Read (910c75a)
- make data io::Read (77b3680)
- Update client_tests.rs (4c50132)
- update to v2 upload sarif (e38bacb)
Code Refactoring
2.0.2 (2024-03-30)
Bug Fixes
2.0.1 (2024-03-29)
Bug Fixes
- macros: protocol macro fix to spread fn args (b261a28)
2.0.0 (2024-03-29)
β BREAKING CHANGES
- protocol -> coding
Code Refactoring
- protocol -> coding (5f86bc7)
1.1.1 (2024-03-29)
Bug Fixes
- ignore e2e tests (e066dde)
1.1.0 (2024-03-29)
Features
- macros: service macro to remove boilerplate code (e0a9295)
1.0.0 (2024-03-25)
β BREAKING CHANGES
- merge all the creates
Code Refactoring
- merge all the creates (faa0a1a)
0.6.0 (2024-03-21)
Features
- virtio support (ce13217)
0.5.1 (2024-03-15)
Bug Fixes
0.5.0 (2024-03-15)
Features
- rust-clippy code scanning (3dfb39f)
Bug Fixes
- update to v2 upload sarif (e38bacb)
0.4.0 (2024-03-14)
Features
0.3.2 (2024-03-14)
Bug Fixes
- auto-release feature (6505b0f)
0.3.1 (2024-03-14)
Bug Fixes
0.3.0 (2024-03-14)
Features
0.2.0 (2024-03-14)
Features
- release please (044cceb)
JetStream Cloudflare
Let's say you've defined a service like so
use jetstream::prelude::*;
#[cfg(feature = "server")]
mod server;
#[service]
pub trait Radar {
async fn ping(
&mut self,
) -> std::result::Result<(), jetstream::prelude::Error>;
}
The glue code for running it on Cloudflare Workers is
use jetstream::cloudflare::DefaultHtmlFallback;
use worker::{event, *};
use crate::{radar_protocol, Radar};
struct RadarWorker;
impl Radar for RadarWorker {
async fn ping(
&mut self,
) -> std::result::Result<(), jetstream::prelude::Error> {
Ok(())
}
}
#[event(fetch)]
async fn fetch(
req: Request,
env: Env,
ctx: worker::Context,
) -> Result<Response> {
let handler = radar_protocol::RadarService { inner: RadarWorker };
let mut router =
jetstream::cloudflare::Router::<DefaultHtmlFallback>::new([handler]);
router.fetch(req, env, ctx).await
}
The code for connecting to it is as follows:
#![cfg(feature = "client")]
use std::time::Instant;
use argh::FromArgs;
use jetstream::{
cloudflare::JETSTREAM_PROTO_HEADER_KEY,
prelude::tracing,
websocket::tokio_tungstenite::{
connect_async, tungstenite::client::IntoClientRequest,
},
};
use jetstream_radar::{
radar_protocol::{self, RadarChannel},
Radar,
};
use reqwest::header::HeaderValue;
use url::Url;
#[derive(FromArgs, PartialEq, Debug)]
/// Top-level command.
struct Client {
#[argh(subcommand)]
nested: Nested,
}
#[derive(FromArgs, PartialEq, Debug)]
#[argh(subcommand)]
enum Nested {
Ping(Ping),
}
#[derive(FromArgs, PartialEq, Debug)]
/// First subcommand.
#[argh(subcommand, name = "ping")]
struct Ping {
#[argh(
option,
default = "Url::parse(\"wss://radar.jetstream.rs\").unwrap()"
)]
/// url to call
url: Url,
}
#[tokio::main]
async fn main() {
rustls::crypto::ring::default_provider()
.install_default()
.expect("Failed to install rustls crypto provider");
let args: Client = argh::from_env();
match args.nested {
Nested::Ping(web_socket) => {
tracing::info!("Connecting to {}", web_socket.url);
let mut req = web_socket.url.clone().into_client_request().unwrap();
// this is a custom header, doesn't have anything to do with websocket handshake
req.headers_mut().insert(
JETSTREAM_PROTO_HEADER_KEY,
HeaderValue::from_static(radar_protocol::PROTOCOL_VERSION),
);
tracing::info!("Attempting websocket connection...");
let (ws_stream, response) = connect_async(req).await.unwrap();
tracing::info!(
"Connected! Response status: {:?}",
response.status()
);
let mut ws_transport = jetstream::websocket::WebSocketTransport::<
RadarChannel,
>::from(ws_stream);
let mut client = radar_protocol::RadarChannel {
inner: Box::new(&mut ws_transport),
};
tracing::info!("Sending ping...");
let now = Instant::now();
match tokio::time::timeout(
std::time::Duration::from_secs(5),
client.ping(),
)
.await
{
Ok(Ok(_)) => {
println!("pong {}ms", now.elapsed().as_millis());
}
Ok(Err(e)) => tracing::error!("Ping failed: {:?}", e),
Err(_) => tracing::error!("Ping timed out after 5 seconds"),
}
tracing::info!("Client completed");
}
};
}
π¦ Crates
For detailed API documentation of all crates in this repository, please see the rustdoc documentation.
The main crates include:
- jetstream - The main crate with the
jetstream::preludemodule - jetstream_client - Client implementation
- jetstream_server - Server implementation
- jetstream_wireformat - Encoding and decoding logic
- jetstream_macros - Procedural macros
- jetstream_rpc - RPC framework core
- jetstream_9p - 9P protocol implementation
- jetstream_ufs - UFS (Unix File System) implementation
- jetstream_quic - QUIC transport
- jetstream_iroh - Iroh transport
- jetstream_websocket - WebSocket transport