pub struct MarketStream { /* private fields */ }Expand description
A live connection to the markets endpoint.
Implementations§
Source§impl MarketStream
impl MarketStream
Sourcepub async fn next(&mut self) -> Option<StreamMessage>
pub async fn next(&mut self) -> Option<StreamMessage>
Await the next message, or None once the stream has closed.
Sourcepub fn endpoint(&self) -> StreamEndpoint
pub fn endpoint(&self) -> StreamEndpoint
Which socket this handle is attached to.
pub fn is_shutdown(&self) -> bool
Sourcepub async fn subscribe(
&self,
subscription: MarketSubscription,
) -> Result<(), PolymarketUsError>
pub async fn subscribe( &self, subscription: MarketSubscription, ) -> Result<(), PolymarketUsError>
Add a subscription to the live connection.
The frame is sent immediately and replayed after every reconnect.
Sourcepub async fn unsubscribe(
&self,
request_id: &str,
) -> Result<(), PolymarketUsError>
pub async fn unsubscribe( &self, request_id: &str, ) -> Result<(), PolymarketUsError>
Cancel a subscription by the requestId it was created with.
The subscription is dropped from the reconnect list immediately
and an unsubscribe frame is sent over the live connection.
Auto Trait Implementations§
impl Freeze for MarketStream
impl RefUnwindSafe for MarketStream
impl Send for MarketStream
impl Sync for MarketStream
impl Unpin for MarketStream
impl UnsafeUnpin for MarketStream
impl UnwindSafe for MarketStream
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