pub struct PolymarketWebSocket { /* private fields */ }Expand description
WebSocket client for connecting to Polymarket’s market data stream
Implementations§
Source§impl PolymarketWebSocket
impl PolymarketWebSocket
Sourcepub fn new(asset_ids: Vec<String>) -> Self
pub fn new(asset_ids: Vec<String>) -> Self
Create a new WebSocket client for the given asset IDs
Sourcepub async fn connect_and_listen<F>(&mut self, on_update: F) -> Result<()>
pub async fn connect_and_listen<F>(&mut self, on_update: F) -> Result<()>
Connect to the WebSocket and listen for updates
The callback function will be called for each message received.
Sourcepub fn update_market_info(&mut self, asset_id: String, info: MarketInfo)
pub fn update_market_info(&mut self, asset_id: String, info: MarketInfo)
Update cached market info for an asset
Sourcepub fn get_market_info(&self, asset_id: &str) -> Option<&MarketInfo>
pub fn get_market_info(&self, asset_id: &str) -> Option<&MarketInfo>
Get cached market info for an asset
Auto Trait Implementations§
impl Freeze for PolymarketWebSocket
impl RefUnwindSafe for PolymarketWebSocket
impl Send for PolymarketWebSocket
impl Sync for PolymarketWebSocket
impl Unpin for PolymarketWebSocket
impl UnwindSafe for PolymarketWebSocket
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