pub struct EventChannel { /* private fields */ }Expand description
A running bidirectional HTTP event channel.
Created via EventChannel::start and stored in
AgentSession. The channel is torn down when
EventChannel is dropped (the server graceful-shutdown completes).
Implementations§
Source§impl EventChannel
impl EventChannel
Sourcepub fn start(config: EventChannelConfig) -> Result<Option<Self>, AgentError>
pub fn start(config: EventChannelConfig) -> Result<Option<Self>, AgentError>
Bind the HTTP server on EventChannelConfig::listen and spawn the
event-loop in a background tokio task. Returns Ok(None) when
config.enabled is false, or an error if binding fails.
This is a synchronous method — it uses a std TcpListener to bind,
then converts the socket to a tokio listener.
Sourcepub fn try_drain_incoming(&mut self) -> Vec<ExternalEvent>
pub fn try_drain_incoming(&mut self) -> Vec<ExternalEvent>
Non-blocking drain of all external events whose topic matches a configured subscription pattern.
Sourcepub fn to_system_message(event: &ExternalEvent) -> Message
pub fn to_system_message(event: &ExternalEvent) -> Message
Convert a drained ExternalEvent into a system message ready for
injection into the conversation.
Auto Trait Implementations§
impl Freeze for EventChannel
impl !RefUnwindSafe for EventChannel
impl Send for EventChannel
impl Sync for EventChannel
impl Unpin for EventChannel
impl UnsafeUnpin for EventChannel
impl !UnwindSafe for EventChannel
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more