#[non_exhaustive]pub struct SessionConfig {
pub channel_capacity: usize,
pub keep_alive: Option<Duration>,
pub sse_retry: Option<Duration>,
pub completed_cache_ttl: Duration,
}client or server) and crate feature transport-streamable-http-server-session only.Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.channel_capacity: usizethe capacity of the channel for the session. Default is 16.
keep_alive: Option<Duration>The session will be closed after this duration of inactivity.
This serves as a safety net for cleaning up sessions whose HTTP
connections have silently dropped (e.g., due to an HTTP/2
RST_STREAM). Without a timeout, such sessions become zombies:
the session worker keeps running indefinitely because the session
handle’s sender is still held in the session manager, preventing
the worker’s event channel from closing.
Defaults to 5 minutes. Set to None to disable (not recommended
for long-running servers behind proxies).
sse_retry: Option<Duration>SSE retry interval for priming events on request-wise streams.
When set, the session layer prepends a priming event with the correct
stream-identifying event ID to each request-wise SSE stream.
Default is 3 seconds, matching StreamableHttpServerConfig::default().
completed_cache_ttl: DurationHow long to retain completed request-wise channel caches for late resume requests. After this duration, completed entries are evicted and resume will return an error. Default is 60 seconds.
Implementations§
Source§impl SessionConfig
impl SessionConfig
pub const DEFAULT_CHANNEL_CAPACITY: usize = 16
pub const DEFAULT_KEEP_ALIVE: Duration
pub const DEFAULT_SSE_RETRY: Duration
pub const DEFAULT_COMPLETED_CACHE_TTL: Duration
Trait Implementations§
Source§impl Clone for SessionConfig
impl Clone for SessionConfig
Source§fn clone(&self) -> SessionConfig
fn clone(&self) -> SessionConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more