pub trait Transport: Send + Sync {
type Sub: Stream<Item = Result<Vec<Vec<u8>>>> + Unpin + Send;
type Pub: PublishSink + Send;
// Required methods
fn send<'life0, 'async_trait>(
&'life0 self,
payload: Vec<u8>,
timeout_ms: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Self::Sub>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn publish<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Self::Pub>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
// Provided method
fn forbids_cleartext_envelope(&self) -> bool { ... }
}Expand description
Wire transport abstraction.
Native: ZmqConnection wraps ZMQ REQ sockets with auto-reconnect.
WASM: WtConnection wraps WebTransport bidi streams with ZMTP framing.
Both transports carry ZMTP-framed messages. The Sub and Pub associated
types provide streaming (server→client) and control (client→server) channels.
Sub must implement futures::Stream yielding frames as Vec<Vec<u8>>,
matching the ZMTP multipart format [topic, capnp_data, mac].
Uses cfg-gated async_trait: Send on native, ?Send on wasm32.
The trait types themselves are Send + Sync (via unsafe impl on wasm32),
so Arc<RpcClient<S, T>> can be shared across threads on native.
Individual call futures are awaited in place, not spawned.
Required Associated Types§
Sourcetype Sub: Stream<Item = Result<Vec<Vec<u8>>>> + Unpin + Send
type Sub: Stream<Item = Result<Vec<Vec<u8>>>> + Unpin + Send
Subscriber type for data streams (server→client).
Must yield ZMTP multipart frames as Vec<Vec<u8>>.
Sourcetype Pub: PublishSink + Send
type Pub: PublishSink + Send
Publisher type for control channel (client→server).
Required Methods§
Sourcefn send<'life0, 'async_trait>(
&'life0 self,
payload: Vec<u8>,
timeout_ms: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
payload: Vec<u8>,
timeout_ms: Option<i32>,
) -> Pin<Box<dyn Future<Output = Result<Vec<u8>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a request and receive a response (REQ/REP pattern).
timeout_ms: Optional timeout in milliseconds. Implementations should
use a default (e.g., 30s) when None. On native, this caps the ZMQ
recv timeout. On WASM, WebTransport stream lifetime handles this.
Sourcefn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Self::Sub>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn subscribe<'life0, 'life1, 'async_trait>(
&'life0 self,
topic: &'life1 [u8],
) -> Pin<Box<dyn Future<Output = Result<Self::Sub>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Subscribe to a topic (SUB pattern). Returns a stream of multipart frames.
Provided Methods§
Sourcefn forbids_cleartext_envelope(&self) -> bool
fn forbids_cleartext_envelope(&self) -> bool
Whether this carrier forbids cleartext request envelopes.
Networked/untrusted carriers require the RPC client to populate
SignedEnvelope.encrypted_envelope with a HyKEM/COSE_Encrypt0 payload.
Fail-closed default (true). A carrier is treated as untrusted for
envelope confidentiality unless it explicitly opts out — so a new or
out-of-tree Transport cannot silently inherit cleartext permission
(epic #550 principle 1: no silent downgrade). Only same-process and
same-host IPC transports (InMemoryTransport, LazyUdsTransport)
override this to false. Every QUIC carrier
(QuinnTransport, LazyQuinnTransport) and iroh carrier forbids
cleartext unconditionally — a loopback address earns NO exemption, since
it is not evidence the bytes stay inside the trust boundary (it can
terminate at a proxy/tunnel). This mirrors
EndpointType::forbids_cleartext_envelope,
the parallel config-time classification; the two are intentionally
layered (pre-dial classification vs runtime enforcement) rather than
delegated, so a runtime transport need not reconstruct an EndpointType.