Expand description
Async SSE event stream with typed deserialization.
EventStream provides an async next() iterator over
a2a_protocol_types::StreamResponse events received via Server-Sent Events.
The stream terminates when:
- The underlying HTTP body closes (normal end-of-stream).
- A
a2a_protocol_types::TaskStatusUpdateEventwithfinal: trueis received. - A protocol or transport error occurs (returned as
Some(Err(...))).
§Example
ⓘ
let mut stream = client.stream_message(params).await?;
while let Some(event) = stream.next().await {
match event? {
StreamResponse::StatusUpdate(ev) => {
println!("State: {:?}", ev.state);
if ev.r#final { break; }
}
StreamResponse::ArtifactUpdate(ev) => {
println!("Artifact: {:?}", ev.artifact);
}
_ => {}
}
}Structs§
- Event
Stream - An async stream of
StreamResponseevents from an SSE endpoint.