Skip to main content

Module transport

Module transport 

Source
Expand description

Getting events from somewhere.

Everything else in this crate is synchronous. This is the one layer that talks to the outside world, and the only place async appears — which is what lets the rest of the crate run under any executor, or none.

Transport is deliberately small: hand it a RunAgentInput, get back a stream of Events. Implementations shipped here:

  • sse — the text/event-stream decoder every HTTP transport needs.
  • http (feature http)HttpTransport, backed by reqwest.
  • replayReplayTransport, which serves a scripted list of events and records what was sent to it. Tests use it; so does the doc example.

A wasm frontend, an in-process agent, a websocket, a recorded fixture: each is an impl Transport, and nothing above this module changes.

Re-exports§

pub use replay::ReplayTransport;
pub use sse::SseDecoder;
pub use sse::SseFrame;
pub use sse::decode_events;
pub use http::HttpTransport;
pub use http::HttpTransportBuilder;

Modules§

http
The reqwest-backed HTTP transport.
replay
A transport that replays a scripted list of events.
sse
Decoding text/event-stream.

Traits§

Transport
Somewhere an agent’s events come from.

Functions§

boxed_stream
Boxes a stream into the shape Transport::run returns.

Type Aliases§

EventStream
A boxed stream of events, as a transport hands it over.
TransportFuture
The future Transport::run returns: connecting, before any event arrives.