Expand description
Bidirectional connection driver for message-based transports.
This module provides the core connection handling for roam over transports that already provide message framing (like WebSocket).
For byte-stream transports (TCP, Unix sockets), see roam-stream which
wraps streams in COBS framing before using this driver.
§Example
ⓘ
use roam_session::{accept_framed, HandshakeConfig, NoDispatcher};
use roam_websocket::WsTransport;
let transport = WsTransport::connect("ws://localhost:9000").await?;
let (handle, driver) = accept_framed(transport, HandshakeConfig::default(), NoDispatcher).await?;
// Spawn the driver (uses runtime abstraction - works on native and WASM)
roam_session::runtime::spawn(async move {
let _ = driver.run().await;
});
// Use handle with generated client
let client = MyServiceClient::new(handle);
let response = client.echo("hello").await?;Structs§
- Driver
- The connection driver - a future that handles bidirectional RPC.
- Framed
Client - A client for message transports that automatically reconnects on failure.
- Handshake
Config - Configuration for connection handshake.
- Incoming
Connection - An incoming virtual connection request.
- Negotiated
- Negotiated connection parameters after Hello exchange.
- NoDispatcher
- A no-op dispatcher for client-only connections.
- Retry
Policy - Configuration for reconnection behavior.
Enums§
- Connect
Error - Error from a reconnecting client.
- Connection
Error - Error during connection handling.
Traits§
- Message
Connector - A factory that creates new message-based connections on demand.
Functions§
- accept_
framed - Accept a connection with a pre-framed transport (e.g., WebSocket).
- connect_
framed - Connect using a message transport with automatic reconnection.
- connect_
framed_ with_ policy - Connect using a message transport with a custom retry policy.
- initiate_
framed - Initiate a connection with a pre-framed transport (e.g., WebSocket).
Type Aliases§
- Incoming
Connections - Receiver for incoming virtual connection requests.