pub struct ClientSseTransport<R>{ /* private fields */ }
Expand description
Client-side Server-Sent Events (SSE) transport implementation
Manages SSE connections, HTTP POST requests, and message streaming for client-server communication.
Implementations§
Source§impl<R> ClientSseTransport<R>
impl<R> ClientSseTransport<R>
Sourcepub fn new(
server_url: &str,
options: ClientSseTransportOptions,
) -> Result<ClientSseTransport<R>, TransportError>
pub fn new( server_url: &str, options: ClientSseTransportOptions, ) -> Result<ClientSseTransport<R>, TransportError>
Sourcepub fn validate_message_endpoint(
&self,
endpoint: String,
) -> Result<String, TransportError>
pub fn validate_message_endpoint( &self, endpoint: String, ) -> Result<String, TransportError>
Trait Implementations§
Source§impl<R, S, M, OR, OM> Transport<R, S, M, OR, OM> for ClientSseTransport<M>
impl<R, S, M, OR, OM> Transport<R, S, M, OR, OM> for ClientSseTransport<M>
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ReceiverStream<R>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MessageDispatcher<M>: McpDispatch<R, OR, M, OM>,
ClientSseTransport<M>: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<ReceiverStream<R>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MessageDispatcher<M>: McpDispatch<R, OR, M, OM>,
ClientSseTransport<M>: 'async_trait,
Starts the transport, initializing SSE and POST tasks
Sets up the SSE stream, POST request handler, and message streams for communication.
§Returns
TransportResult<(Pin<Box<dyn Stream<Item = R> + Send>>, MessageDispatcher<R>, IoStream)>
- The message stream, dispatcher, and error stream
Source§fn is_shut_down<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
ClientSseTransport<M>: 'async_trait,
fn is_shut_down<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = bool> + Send + 'async_trait>>where
'life0: 'async_trait,
ClientSseTransport<M>: 'async_trait,
Checks if the transport has been shut down
§Returns
bool
- True if the transport is shut down, false otherwise
Source§fn shut_down<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
ClientSseTransport<M>: 'async_trait,
fn shut_down<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
ClientSseTransport<M>: 'async_trait,
fn message_sender(&self) -> Arc<RwLock<Option<MessageDispatcher<M>>>>
fn error_stream(&self) -> &RwLock<Option<IoStream>>
fn consume_string_payload<'life0, 'life1, 'async_trait>(
&'life0 self,
_payload: &'life1 str,
) -> Pin<Box<dyn Future<Output = Result<(), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
ClientSseTransport<M>: 'async_trait,
fn keep_alive<'life0, 'async_trait>(
&'life0 self,
__arg1: Duration,
__arg2: Sender<()>,
) -> Pin<Box<dyn Future<Output = Result<JoinHandle<()>, TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
ClientSseTransport<M>: 'async_trait,
fn pending_request_tx<'life0, 'life1, 'async_trait>(
&'life0 self,
request_id: &'life1 RequestId,
) -> Pin<Box<dyn Future<Output = Option<Sender<M>>> + Send + 'async_trait>>where
'life0: 'async_trait,
'life1: 'async_trait,
ClientSseTransport<M>: 'async_trait,
Auto Trait Implementations§
impl<R> !Freeze for ClientSseTransport<R>
impl<R> !RefUnwindSafe for ClientSseTransport<R>
impl<R> Send for ClientSseTransport<R>
impl<R> Sync for ClientSseTransport<R>
impl<R> Unpin for ClientSseTransport<R>
impl<R> !UnwindSafe for ClientSseTransport<R>
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