pub struct EventManager { /* private fields */ }Expand description
Handles SSE event processing and broadcasting to connected clients
This struct manages the broadcasting of events to multiple SSE clients using a Tokio broadcast channel. It provides methods for sending different types of events and handling SSE connections.
Implementations§
Source§impl EventManager
impl EventManager
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Create a new EventManager with the specified channel capacity
Sourcepub fn subscribe(&self) -> Receiver<SSEMessage>
pub fn subscribe(&self) -> Receiver<SSEMessage>
Subscribe to events
Sourcepub fn send_tool_response(
&self,
request_id: &str,
_server_id: &str,
_tool_name: &str,
data: Value,
)
pub fn send_tool_response( &self, request_id: &str, _server_id: &str, _tool_name: &str, data: Value, )
Send a tool response event using JSON-RPC format
Sourcepub fn send_tool_error(
&self,
request_id: &str,
server_id: &str,
tool_name: &str,
error: &str,
)
pub fn send_tool_error( &self, request_id: &str, server_id: &str, tool_name: &str, error: &str, )
Send a tool error event using JSON-RPC format
Sourcepub fn send_server_status(
&self,
server_name: &str,
server_id: &str,
status: &str,
)
pub fn send_server_status( &self, server_name: &str, server_id: &str, status: &str, )
Send a server status update event
Sourcepub fn send_notification(&self, title: &str, message: &str, level: &str)
pub fn send_notification(&self, title: &str, message: &str, level: &str)
Send a notification event
Sourcepub fn format_sse_message(message: &SSEMessage) -> Bytes
pub fn format_sse_message(message: &SSEMessage) -> Bytes
Format an SSEMessage for the wire
Trait Implementations§
Source§impl Clone for EventManager
impl Clone for EventManager
Source§fn clone(&self) -> EventManager
fn clone(&self) -> EventManager
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for EventManager
impl !RefUnwindSafe for EventManager
impl Send for EventManager
impl Sync for EventManager
impl Unpin for EventManager
impl !UnwindSafe for EventManager
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