pub struct StreamingHttpClientTransport { /* private fields */ }Expand description
Streaming HTTP client transport with advanced features
Implementations§
Source§impl StreamingHttpClientTransport
impl StreamingHttpClientTransport
Sourcepub async fn new<S: AsRef<str>>(base_url: S) -> McpResult<Self>
pub async fn new<S: AsRef<str>>(base_url: S) -> McpResult<Self>
Create streaming HTTP transport with default configuration
Sourcepub async fn with_config<S: AsRef<str>>(
base_url: S,
config: StreamingConfig,
) -> McpResult<Self>
pub async fn with_config<S: AsRef<str>>( base_url: S, config: StreamingConfig, ) -> McpResult<Self>
Create streaming HTTP transport with custom configuration
pub async fn get_stats(&self) -> TransportStats
pub async fn get_analysis_stats(&self) -> AnalysisStats
Sourcepub async fn register_push_handler<F>(&mut self, path: String, handler: F)
pub async fn register_push_handler<F>(&mut self, path: String, handler: F)
Register a server push handler for specific paths
Sourcepub async fn get_http2_stats(&self) -> (usize, u64, u64)
pub async fn get_http2_stats(&self) -> (usize, u64, u64)
Get HTTP/2 stream statistics
Sourcepub async fn send_multiplexed_requests(
&mut self,
requests: Vec<JsonRpcRequest>,
) -> McpResult<Vec<JsonRpcResponse>>
pub async fn send_multiplexed_requests( &mut self, requests: Vec<JsonRpcRequest>, ) -> McpResult<Vec<JsonRpcResponse>>
Send multiplexed HTTP/2 requests for improved performance
Trait Implementations§
Source§impl Transport for StreamingHttpClientTransport
impl Transport for StreamingHttpClientTransport
Source§fn send_request<'life0, 'async_trait>(
&'life0 mut self,
request: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = McpResult<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_request<'life0, 'async_trait>(
&'life0 mut self,
request: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = McpResult<JsonRpcResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a JSON-RPC request and wait for a response Read more
Source§fn send_notification<'life0, 'async_trait>(
&'life0 mut self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_notification<'life0, 'async_trait>(
&'life0 mut self,
notification: JsonRpcNotification,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send a JSON-RPC notification (no response expected) Read more
Source§fn receive_notification<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<Option<JsonRpcNotification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn receive_notification<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<Option<JsonRpcNotification>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Receive a notification from the server (non-blocking) Read more
Source§fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn close<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Close the transport connection Read more
Source§fn open_subscription<'life0, 'async_trait>(
&'life0 mut self,
_request: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = McpResult<ClientSubscription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn open_subscription<'life0, 'async_trait>(
&'life0 mut self,
_request: JsonRpcRequest,
) -> Pin<Box<dyn Future<Output = McpResult<ClientSubscription>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Open a modern long-lived subscription stream.
Source§fn cancel_subscription<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_request_id: &'life1 Value,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn cancel_subscription<'life0, 'life1, 'async_trait>(
&'life0 mut self,
_request_id: &'life1 Value,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Cancel an open subscription. HTTP implementations close the response
stream; STDIO implementations send
notifications/cancelled.Source§fn handle_incoming_request<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<Option<JsonRpcRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle_incoming_request<'life0, 'async_trait>(
&'life0 mut self,
) -> Pin<Box<dyn Future<Output = McpResult<Option<JsonRpcRequest>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle incoming server request (for bidirectional communication) Read more
Source§fn send_response<'life0, 'async_trait>(
&'life0 mut self,
_response: JsonRpcResponse,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn send_response<'life0, 'async_trait>(
&'life0 mut self,
_response: JsonRpcResponse,
) -> Pin<Box<dyn Future<Output = McpResult<()>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Send response to server request (for bidirectional communication) Read more
Source§fn is_connected(&self) -> bool
fn is_connected(&self) -> bool
Check if the transport is connected Read more
Source§fn connection_info(&self) -> String
fn connection_info(&self) -> String
Get connection information for debugging Read more
Auto Trait Implementations§
impl !Freeze for StreamingHttpClientTransport
impl !RefUnwindSafe for StreamingHttpClientTransport
impl !UnwindSafe for StreamingHttpClientTransport
impl Send for StreamingHttpClientTransport
impl Sync for StreamingHttpClientTransport
impl Unpin for StreamingHttpClientTransport
impl UnsafeUnpin for StreamingHttpClientTransport
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
§impl<T> FutureExt for T
impl<T> FutureExt for T
§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Applies the layer to a service and wraps it in [
Layered].