pub struct CryptoPriceWebSocket { /* private fields */ }Expand description
Streams real-time crypto prices from a WebSocket feed.
Supports Binance and Chainlink price sources. Requires explicit subscribe/unsubscribe messages and client-initiated PING every 5 seconds.
Implementations§
Source§impl CryptoPriceWebSocket
impl CryptoPriceWebSocket
pub fn new() -> Self
pub fn state(&self) -> WebSocketState
pub fn stream(&self) -> CryptoPriceStream
Sourcepub async fn subscribe(
&self,
source: CryptoPriceSource,
symbols: &[String],
) -> Result<(), WebSocketError>
pub async fn subscribe( &self, source: CryptoPriceSource, symbols: &[String], ) -> Result<(), WebSocketError>
Subscribe to crypto prices for the given source and symbols. Empty symbols subscribes to all available symbols.
Sourcepub async fn unsubscribe(
&self,
source: CryptoPriceSource,
symbols: &[String],
) -> Result<(), WebSocketError>
pub async fn unsubscribe( &self, source: CryptoPriceSource, symbols: &[String], ) -> Result<(), WebSocketError>
Unsubscribe from crypto prices for the given source and symbols.
pub async fn connect(&mut self) -> Result<(), WebSocketError>
pub async fn disconnect(&mut self) -> Result<(), WebSocketError>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CryptoPriceWebSocket
impl !RefUnwindSafe for CryptoPriceWebSocket
impl Send for CryptoPriceWebSocket
impl Sync for CryptoPriceWebSocket
impl Unpin for CryptoPriceWebSocket
impl UnsafeUnpin for CryptoPriceWebSocket
impl !UnwindSafe for CryptoPriceWebSocket
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