pub struct WebSocketSession { /* private fields */ }Expand description
WebSocket session manager
Implementations§
Source§impl WebSocketSession
impl WebSocketSession
Sourcepub fn new(
config: impl Into<Arc<WebSocketConfig>>,
subscription_manager: Arc<Mutex<SubscriptionManager>>,
) -> Self
pub fn new( config: impl Into<Arc<WebSocketConfig>>, subscription_manager: Arc<Mutex<SubscriptionManager>>, ) -> Self
Create a new WebSocket session.
Accepts anything convertible into Arc<WebSocketConfig>, which
via Rust’s blanket impl<T> From<T> for Arc<T> covers both an
owned WebSocketConfig (wrapped once here) and an existing
Arc<WebSocketConfig> shared with
crate::client::DeribitWebSocketClient (zero extra copies).
This keeps the constructor backward-compatible with pre-existing
owned-value call sites while also giving the client a zero-copy
path for its shared configuration.
Sourcepub async fn state(&self) -> ConnectionState
pub async fn state(&self) -> ConnectionState
Get the current connection state
Sourcepub async fn set_state(&self, new_state: ConnectionState)
pub async fn set_state(&self, new_state: ConnectionState)
Set the connection state
Sourcepub fn config(&self) -> &WebSocketConfig
pub fn config(&self) -> &WebSocketConfig
Get the configuration
Sourcepub fn subscription_manager(&self) -> Arc<Mutex<SubscriptionManager>> ⓘ
pub fn subscription_manager(&self) -> Arc<Mutex<SubscriptionManager>> ⓘ
Get the subscription manager
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if session is connected
Sourcepub async fn is_authenticated(&self) -> bool
pub async fn is_authenticated(&self) -> bool
Check if session is authenticated
Sourcepub async fn mark_authenticated(&self)
pub async fn mark_authenticated(&self)
Mark session as authenticated
Sourcepub async fn mark_disconnected(&self)
pub async fn mark_disconnected(&self)
Mark session as disconnected
Sourcepub async fn reactivate_subscriptions(&self)
pub async fn reactivate_subscriptions(&self)
Reactivate subscriptions after reconnection