Struct ethers::providers::Ws [−][src]
pub struct Ws { /* fields omitted */ }
Expand description
A JSON-RPC Client over Websockets.
use ethers_providers::Ws;
let ws = Ws::connect("wss://localhost:8545").await?;
Implementations
Initializes a new WebSocket Client, given a Stream/Sink Websocket implementer. The websocket connection must be initiated separately.
Trait Implementations
type Error = ClientError
type Error = ClientError
A JSON-RPC Error
pub fn request<'life0, 'life1, 'async_trait, T, R>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, ClientError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + 'async_trait,
Ws: 'async_trait,
pub fn request<'life0, 'life1, 'async_trait, T, R>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, ClientError>> + Send + 'async_trait, Global>> where
'life0: 'async_trait,
'life1: 'async_trait,
T: Serialize + Send + Sync + 'async_trait,
R: DeserializeOwned + 'async_trait,
Ws: 'async_trait,
Sends a request with the provided JSON-RPC and parameters serialized as JSON
type NotificationStream = UnboundedReceiver<Value>
type NotificationStream = UnboundedReceiver<Value>
The type of stream this transport returns
pub fn subscribe<T>(
&self,
id: T
) -> Result<<Ws as PubsubClient>::NotificationStream, ClientError> where
T: Into<U256>,
pub fn subscribe<T>(
&self,
id: T
) -> Result<<Ws as PubsubClient>::NotificationStream, ClientError> where
T: Into<U256>,
Add a subscription to this transport
Remove a subscription from this transport
Auto Trait Implementations
Blanket Implementations
Mutably borrows from an owned value. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
pub fn vzip(self) -> V
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more