#[non_exhaustive]pub struct StreamableHttpClientTransportConfig {
pub uri: Arc<str>,
pub retry_config: Arc<dyn SseRetryPolicy>,
pub channel_buffer_capacity: usize,
pub allow_stateless: bool,
pub auth_header: Option<String>,
pub custom_headers: HashMap<HeaderName, HeaderValue>,
pub reinit_on_expired_session: bool,
}Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.uri: Arc<str>§retry_config: Arc<dyn SseRetryPolicy>§channel_buffer_capacity: usize§allow_stateless: boolif true, the transport will not require a session to be established
auth_header: Option<String>The value to send in the authorization header
custom_headers: HashMap<HeaderName, HeaderValue>Custom HTTP headers to include with every request
reinit_on_expired_session: boolEnables transparent recovery when the server reports an expired session (HTTP 404).
When enabled, the transport performs one automatic recovery attempt:
- Replays the original
initializehandshake to create a new session. - Re-establishes streaming state for that session.
- Retries the in-flight request that failed with
SessionExpired.
This recovery is best-effort and bounded to a single attempt. If recovery fails, the original failure path is preserved and the error is returned to the caller.
Implementations§
Source§impl StreamableHttpClientTransportConfig
impl StreamableHttpClientTransportConfig
pub fn with_uri(uri: impl Into<Arc<str>>) -> StreamableHttpClientTransportConfig
Sourcepub fn auth_header<T>(self, value: T) -> StreamableHttpClientTransportConfig
pub fn auth_header<T>(self, value: T) -> StreamableHttpClientTransportConfig
Set the authorization header to send with requests
§Arguments
value- A bearer token without theBearerprefix
Sourcepub fn custom_headers(
self,
custom_headers: HashMap<HeaderName, HeaderValue>,
) -> StreamableHttpClientTransportConfig
pub fn custom_headers( self, custom_headers: HashMap<HeaderName, HeaderValue>, ) -> StreamableHttpClientTransportConfig
Set custom HTTP headers to include with every request
§Arguments
custom_headers- A HashMap of header names to header values
§Example
use std::collections::HashMap;
use http::{HeaderName, HeaderValue};
use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
let mut headers = HashMap::new();
headers.insert(
HeaderName::from_static("x-custom-header"),
HeaderValue::from_static("custom-value")
);
let config = StreamableHttpClientTransportConfig::with_uri("http://localhost:8000")
.custom_headers(headers);Sourcepub fn reinit_on_expired_session(
self,
enable: bool,
) -> StreamableHttpClientTransportConfig
pub fn reinit_on_expired_session( self, enable: bool, ) -> StreamableHttpClientTransportConfig
Set whether the transport should attempt transparent re-initialization on session expiration
See Self::reinit_on_expired_session for details.
§Example
use rmcp::transport::streamable_http_client::StreamableHttpClientTransportConfig;
let config = StreamableHttpClientTransportConfig::with_uri("http://localhost:8000")
.reinit_on_expired_session(true);Trait Implementations§
Source§impl Clone for StreamableHttpClientTransportConfig
impl Clone for StreamableHttpClientTransportConfig
Source§fn clone(&self) -> StreamableHttpClientTransportConfig
fn clone(&self) -> StreamableHttpClientTransportConfig
Returns a duplicate 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 moreSource§impl Default for StreamableHttpClientTransportConfig
impl Default for StreamableHttpClientTransportConfig
Source§fn default() -> StreamableHttpClientTransportConfig
fn default() -> StreamableHttpClientTransportConfig
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for StreamableHttpClientTransportConfig
impl !RefUnwindSafe for StreamableHttpClientTransportConfig
impl Send for StreamableHttpClientTransportConfig
impl Sync for StreamableHttpClientTransportConfig
impl Unpin for StreamableHttpClientTransportConfig
impl UnsafeUnpin for StreamableHttpClientTransportConfig
impl !UnwindSafe for StreamableHttpClientTransportConfig
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more