Expand description
Server startup helpers.
Reduces the ~25 lines of hyper boilerplate typically needed to start an A2A HTTP server down to a single function call.
§Example
use std::sync::Arc;
use a2a_protocol_server::serve::serve;
use a2a_protocol_server::dispatch::JsonRpcDispatcher;
use a2a_protocol_server::RequestHandlerBuilder;
let handler = Arc::new(
RequestHandlerBuilder::new(MyExecutor)
.build()
.expect("build handler"),
);
let dispatcher = JsonRpcDispatcher::new(handler);
serve("127.0.0.1:3000", dispatcher).await?;Structs§
- Serve
Config - Limits applied to a
Server. - Serve
Report - What the socket layer did, and whether it finished.
- Server
- A bound listener that has not started accepting yet.
Constants§
- DEFAULT_
DRAIN_ TIMEOUT - How long to wait for in-flight connections once shutdown is signalled.
- DEFAULT_
HEADER_ READ_ TIMEOUT - How long a peer may take to send a complete set of request headers.
- DEFAULT_
IDLE_ TIMEOUT - How long a connection may sit with no bytes moving in either direction.
Traits§
- Dispatcher
- Trait for types that can dispatch HTTP requests to an A2A handler.
Functions§
- serve
- Starts an HTTP server that dispatches requests using the given dispatcher.
- serve_
with_ addr - Starts an HTTP server and returns the bound
SocketAddr.
Type Aliases§
- Dispatch
Response - The HTTP response type returned by dispatchers.