pub struct MessageRouter { /* private fields */ }Expand description
Message router
Handles reception, parsing, and dispatching of WebSocket messages. Core responsibilities:
- Managing WebSocket connections
- Receiving and routing messages
- Coordinating automatic reconnection
- Managing subscriptions
Implementations§
Source§impl MessageRouter
impl MessageRouter
Sourcepub fn new(
ws_url: String,
subscription_manager: Arc<SubscriptionManager>,
) -> Self
pub fn new( ws_url: String, subscription_manager: Arc<SubscriptionManager>, ) -> Self
Sourcepub async fn start(&self) -> Result<()>
pub async fn start(&self) -> Result<()>
Starts the message router
Establishes the WebSocket connection and launches the message loop
§Returns
Result of the startup sequence
Sourcepub async fn stop(&self) -> Result<()>
pub async fn stop(&self) -> Result<()>
Stops the message router
Terminates the message loop and disconnects the WebSocket client
§Returns
Result of the shutdown procedure
Sourcepub async fn restart(&self) -> Result<()>
pub async fn restart(&self) -> Result<()>
Restarts the message router
Stops the current connection and restarts it, typically used during reconnect scenarios
§Returns
Result of the restart sequence
Sourcepub fn is_connected(&self) -> bool
pub fn is_connected(&self) -> bool
Returns the current connection state
Sourcepub async fn set_reconnect_config(&self, config: ReconnectConfig)
pub async fn set_reconnect_config(&self, config: ReconnectConfig)
Sourcepub async fn get_reconnect_config(&self) -> ReconnectConfig
pub async fn get_reconnect_config(&self) -> ReconnectConfig
Retrieves the current reconnection configuration
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MessageRouter
impl !RefUnwindSafe for MessageRouter
impl Send for MessageRouter
impl Sync for MessageRouter
impl Unpin for MessageRouter
impl !UnwindSafe for MessageRouter
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