pub struct ClientSseTransport { /* 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 ClientSseTransport
impl ClientSseTransport
Sourcepub fn new(
server_url: &str,
options: ClientSseTransportOptions,
) -> Result<ClientSseTransport, TransportError>
pub fn new( server_url: &str, options: ClientSseTransportOptions, ) -> Result<ClientSseTransport, 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> Transport<R, S> for ClientSseTransportwhere
R: RpcMessage + Clone + Send + Sync + DeserializeOwned + 'static,
S: McpMessage + Clone + Send + Sync + Serialize + 'static,
impl<R, S> Transport<R, S> for ClientSseTransportwhere
R: RpcMessage + Clone + Send + Sync + DeserializeOwned + 'static,
S: McpMessage + Clone + Send + Sync + Serialize + 'static,
Source§fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Pin<Box<dyn Stream<Item = R> + Send>>, MessageDispatcher<R>, IoStream), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MessageDispatcher<R>: McpDispatch<R, S>,
ClientSseTransport: 'async_trait,
fn start<'life0, 'async_trait>(
&'life0 self,
) -> Pin<Box<dyn Future<Output = Result<(Pin<Box<dyn Stream<Item = R> + Send>>, MessageDispatcher<R>, IoStream), TransportError>> + Send + 'async_trait>>where
'life0: 'async_trait,
MessageDispatcher<R>: McpDispatch<R, S>,
ClientSseTransport: '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: '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: 'async_trait,
Checks if the transport has been shut down
§Returns
bool
- True if the transport is shut down, false otherwise
Auto Trait Implementations§
impl !Freeze for ClientSseTransport
impl !RefUnwindSafe for ClientSseTransport
impl Send for ClientSseTransport
impl Sync for ClientSseTransport
impl Unpin for ClientSseTransport
impl !UnwindSafe for ClientSseTransport
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