pub struct StreamsResource { /* private fields */ }Expand description
Subscribes to Hot run streams.
Implementations§
Source§impl StreamsResource
impl StreamsResource
Sourcepub fn subscribe(&self, stream_id: &str, project: Option<&str>) -> EventStream
pub fn subscribe(&self, stream_id: &str, project: Option<&str>) -> EventStream
Streams events from an existing run stream.
Sourcepub fn subscribe_post(
&self,
stream_id: &str,
project: Option<&str>,
) -> EventStream
pub fn subscribe_post( &self, stream_id: &str, project: Option<&str>, ) -> EventStream
Streams events from an existing run stream via POST.
Sourcepub async fn wait_for_run_result(
&self,
stream_id: &str,
event_id: &str,
opts: WaitOptions<'_>,
) -> Result<JsonObject>
pub async fn wait_for_run_result( &self, stream_id: &str, event_id: &str, opts: WaitOptions<'_>, ) -> Result<JsonObject>
Subscribes to a stream and returns the run object once the run created
by event_id reaches run:stop. run:fail and run:cancel become
Error::RunFailed carrying the run’s result message.
Sourcepub fn subscribe_with_event(
&self,
body: impl Serialize,
opts: SubscribeWithEventOptions,
) -> EventStream
pub fn subscribe_with_event( &self, body: impl Serialize, opts: SubscribeWithEventOptions, ) -> EventStream
Atomically subscribes then publishes an event, yielding stream events until the run completes.
The Hot API closes SSE subscriptions after 5 minutes of idle time.
While opts.reconnect is true (the default), the SDK resubscribes to
the same stream_id and keeps yielding events until a terminal
run:stop/run:fail/run:cancel arrives. Replayed run:start and terminal
events are deduped by run_id; stream:data chunks are not replayed and
may be lost across the disconnect window.