pub struct SubscribeClient { /* private fields */ }Expand description
A WebSocket subscription client for the chain RPC.
Implementations§
Source§impl SubscribeClient
impl SubscribeClient
Sourcepub async fn connect(endpoint: &str) -> Result<Self>
pub async fn connect(endpoint: &str) -> Result<Self>
Connects to the chain RPC WebSocket endpoint.
endpoint may be a full ws:// / wss:// URL, or an http:// /
https:// base URL (the scheme is upgraded and /websocket appended if
absent). A background task pumps incoming frames to the per-subscription
channels until the connection closes.
Sourcepub fn subscribe(&self, query: &str) -> Result<Subscription>
pub fn subscribe(&self, query: &str) -> Result<Subscription>
Registers a subscription for query and sends the subscribe request,
returning the Subscription handle.
Sourcepub fn subscribe_new_blocks(&self) -> Result<Subscription>
pub fn subscribe_new_blocks(&self) -> Result<Subscription>
Subscribes to committed blocks (QUERY_NEW_BLOCK).
Sourcepub fn subscribe_tx(&self, query: &str) -> Result<Subscription>
pub fn subscribe_tx(&self, query: &str) -> Result<Subscription>
Subscribes to committed transactions matching query. An empty query
subscribes to all transactions; a query without tm.event is AND-ed with
QUERY_TX.
Auto Trait Implementations§
impl Freeze for SubscribeClient
impl RefUnwindSafe for SubscribeClient
impl Send for SubscribeClient
impl Sync for SubscribeClient
impl Unpin for SubscribeClient
impl UnsafeUnpin for SubscribeClient
impl UnwindSafe for SubscribeClient
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