pub struct MessageRouter { /* private fields */ }Expand description
Message router for handling WebSocket connections and message routing
Implementations§
Source§impl MessageRouter
impl MessageRouter
Sourcepub fn new(
ws_url: String,
subscription_manager: Arc<SubscriptionManager>,
listen_key_manager: Option<Arc<ListenKeyManager>>,
) -> Self
pub fn new( ws_url: String, subscription_manager: Arc<SubscriptionManager>, listen_key_manager: Option<Arc<ListenKeyManager>>, ) -> Self
Creates a new message router
Sourcepub async fn start(&self, url_override: Option<String>) -> Result<()>
pub async fn start(&self, url_override: Option<String>) -> Result<()>
Starts the message router
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)
Applies a new reconnection configuration
Sourcepub async fn get_reconnect_config(&self) -> ReconnectConfig
pub async fn get_reconnect_config(&self) -> ReconnectConfig
Retrieves the current reconnection configuration
Sourcepub async fn subscribe(&self, streams: Vec<String>) -> Result<()>
pub async fn subscribe(&self, streams: Vec<String>) -> Result<()>
Subscribes to the provided streams
Sourcepub async fn unsubscribe(&self, streams: Vec<String>) -> Result<()>
pub async fn unsubscribe(&self, streams: Vec<String>) -> Result<()>
Unsubscribes from the provided streams
Sourcepub fn extract_stream_name(message: &Value) -> Result<String>
pub fn extract_stream_name(message: &Value) -> Result<String>
Extracts the stream name from an incoming message
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