pub struct MercurySocket { /* private fields */ }Expand description
Mercury WebSocket connection manager.
Implementations§
Source§impl MercurySocket
impl MercurySocket
pub fn new( _ws_factory: Option<Arc<dyn Fn(String) -> Pin<Box<dyn Future<Output = Result<Box<dyn InjectedWebSocket>, Box<dyn Error + Send + Sync>>> + Send>> + Send + Sync>>, ping_interval: Duration, pong_timeout: Duration, reconnect_backoff_max: Duration, max_reconnect_attempts: u32, ) -> Self
Sourcepub async fn take_event_rx(&self) -> Option<UnboundedReceiver<MercuryEvent>>
pub async fn take_event_rx(&self) -> Option<UnboundedReceiver<MercuryEvent>>
Take the event receiver. Can only be called once.
Sourcepub async fn connect(&self, ws_url: &str, token: &str) -> Result<(), WebexError>
pub async fn connect(&self, ws_url: &str, token: &str) -> Result<(), WebexError>
Connect to Mercury WebSocket.
Sourcepub async fn disconnect(&self)
pub async fn disconnect(&self)
Disconnect from Mercury.
Sourcepub async fn current_reconnect_attempts(&self) -> u32
pub async fn current_reconnect_attempts(&self) -> u32
Current reconnection attempt count.
Auto Trait Implementations§
impl Freeze for MercurySocket
impl !RefUnwindSafe for MercurySocket
impl Send for MercurySocket
impl Sync for MercurySocket
impl Unpin for MercurySocket
impl !UnwindSafe for MercurySocket
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