pub struct ManagedWsProvider { /* private fields */ }Expand description
Managed WebSocket provider with automatic keep-alive and reconnection
This provider builds on top of RawWsProvider to add:
- Automatic ping/pong keep-alive
- Automatic reconnection with subscription replay
- Connection state monitoring
- Configurable retry behavior
Implementations§
Source§impl ManagedWsProvider
impl ManagedWsProvider
Sourcepub async fn connect(
network: Network,
config: WsConfig,
) -> Result<Arc<Self>, HyperliquidError>
pub async fn connect( network: Network, config: WsConfig, ) -> Result<Arc<Self>, HyperliquidError>
Connect with custom configuration
Sourcepub async fn connect_with_defaults(
network: Network,
) -> Result<Arc<Self>, HyperliquidError>
pub async fn connect_with_defaults( network: Network, ) -> Result<Arc<Self>, HyperliquidError>
Connect with default configuration
Sourcepub async fn is_connected(&self) -> bool
pub async fn is_connected(&self) -> bool
Check if currently connected
Sourcepub async fn raw(
&self,
) -> Result<MutexGuard<'_, Option<RawWsProvider>>, HyperliquidError>
pub async fn raw( &self, ) -> Result<MutexGuard<'_, Option<RawWsProvider>>, HyperliquidError>
Get mutable access to the raw provider
Sourcepub async fn subscribe_l2_book(
&self,
coin: impl Into<Symbol>,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_l2_book( &self, coin: impl Into<Symbol>, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to L2 order book updates with automatic replay on reconnect
Sourcepub async fn subscribe_trades(
&self,
coin: impl Into<Symbol>,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_trades( &self, coin: impl Into<Symbol>, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to trades with automatic replay on reconnect
Sourcepub async fn subscribe_all_mids(
&self,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_all_mids( &self, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to all mid prices with automatic replay on reconnect
Sourcepub async fn subscribe_bbo(
&self,
coin: impl Into<Symbol>,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_bbo( &self, coin: impl Into<Symbol>, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to best bid/offer updates for a coin with automatic replay on reconnect
Sourcepub async fn subscribe_open_orders(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_open_orders( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to user’s open orders in real-time with automatic replay on reconnect
Sourcepub async fn subscribe_clearinghouse_state(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_clearinghouse_state( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to user’s clearinghouse state in real-time with automatic replay on reconnect
Sourcepub async fn subscribe_web_data3(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_web_data3( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to aggregate user information (newer version) with automatic replay on reconnect
Sourcepub async fn subscribe_twap_states(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_twap_states( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to TWAP order states with automatic replay on reconnect
Sourcepub async fn subscribe_active_asset_ctx(
&self,
coin: impl Into<Symbol>,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_active_asset_ctx( &self, coin: impl Into<Symbol>, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to active asset context updates with automatic replay on reconnect
Sourcepub async fn subscribe_active_asset_data(
&self,
user: Address,
coin: impl Into<Symbol>,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_active_asset_data( &self, user: Address, coin: impl Into<Symbol>, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to active asset data with automatic replay on reconnect
Sourcepub async fn subscribe_user_twap_slice_fills(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_user_twap_slice_fills( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to TWAP slice fills with automatic replay on reconnect
Sourcepub async fn subscribe_user_twap_history(
&self,
user: Address,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe_user_twap_history( &self, user: Address, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Subscribe to TWAP order history with automatic replay on reconnect
Sourcepub async fn subscribe(
&self,
subscription: Subscription,
) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
pub async fn subscribe( &self, subscription: Subscription, ) -> Result<(SubscriptionId, UnboundedReceiver<Message>), HyperliquidError>
Generic subscription with automatic replay on reconnect
Sourcepub async fn unsubscribe(
&self,
id: SubscriptionId,
) -> Result<(), HyperliquidError>
pub async fn unsubscribe( &self, id: SubscriptionId, ) -> Result<(), HyperliquidError>
Unsubscribe and stop automatic replay
Sourcepub async fn start_reading(&self) -> Result<(), HyperliquidError>
pub async fn start_reading(&self) -> Result<(), HyperliquidError>
Start reading messages (must be called after connecting)
Auto Trait Implementations§
impl Freeze for ManagedWsProvider
impl !RefUnwindSafe for ManagedWsProvider
impl Send for ManagedWsProvider
impl Sync for ManagedWsProvider
impl Unpin for ManagedWsProvider
impl !UnwindSafe for ManagedWsProvider
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more