Expand description
ConnectRPC transport over Tauri IPC.
Carries the Connect protocol over Tauri commands and channels instead of HTTP. The webview is the client; Rust hosts the services.
Neither side reimplements the protocol. ConnectRpcService is already a
tower::Service<http::Request>, and on the TypeScript side
@connectrpc/connect/protocol-connect accepts any byte-level client. This
crate is the shuttle between them, so framing, compression negotiation,
trailers, and error mapping all come from the existing runtime.
§Usage
ⓘ
let router = Arc::new(MyService).register(connectrpc::Router::new());
tauri::Builder::default()
.plugin(connectrpc_tauri::serve(ConnectRpcService::new(router)))
.run(tauri::generate_context!())?;§Concurrency
Every IPC command is async and nothing in the request path blocks the
runtime. The one synchronous lock guards a hash map and is never held across
an await, which the await_holding_lock lint below enforces.
Modules§
- greet
- The demo service used by the tests and the example app.
- testing
- A harness for driving the transport without a webview.
- wire
- Generated wire types for the transport envelopes.
Structs§
- Deferred
Dispatcher - A ConnectRPC dispatcher that can be initialized exactly once.
Constants§
- PLUGIN_
NAME - Name under which the plugin registers. The webview addresses commands as
plugin:connectrpc-tauri|connect_rpc. - SCHEME
- The URI scheme unary calls travel over.
Functions§
- serve
- Serve a
ConnectRpcServiceover Tauri IPC.
Type Aliases§
- CallId
- Identifies one in-flight RPC. Allocated by the webview.