Module driver

Module driver 

Source
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.
FramedClient
A client for message transports that automatically reconnects on failure.
HandshakeConfig
Configuration for connection handshake.
IncomingConnection
An incoming virtual connection request.
Negotiated
Negotiated connection parameters after Hello exchange.
NoDispatcher
A no-op dispatcher for client-only connections.
RetryPolicy
Configuration for reconnection behavior.

Enums§

ConnectError
Error from a reconnecting client.
ConnectionError
Error during connection handling.

Traits§

MessageConnector
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§

IncomingConnections
Receiver for incoming virtual connection requests.