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
pub fn new<S: 'static>(ws: S) -> Self where
S: Send + Sync + Stream<Item = Result<Message, Error>> + Sink<Message, Error = Error> + Unpin,
This is supported on crate feature ws
only.
pub fn new<S: 'static>(ws: S) -> Self where
S: Send + Sync + Stream<Item = Result<Message, Error>> + Sink<Message, Error = Error> + Unpin,
ws
only.Initializes a new WebSocket Client, given a Stream/Sink Websocket implementer. The websocket connection must be initiated separately.
This is supported on crate feature ws
only.
ws
only.Returns true if the WS connection is active, false otherwise
Trait Implementations
type Error = ClientError
type Error = ClientError
A JSON-RPC Error
fn request<'life0, 'life1, 'async_trait, T: Serialize + Send + Sync, R: DeserializeOwned>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, ClientError>> + Send + 'async_trait>> where
T: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait,
fn request<'life0, 'life1, 'async_trait, T: Serialize + Send + Sync, R: DeserializeOwned>(
&'life0 self,
method: &'life1 str,
params: T
) -> Pin<Box<dyn Future<Output = Result<R, ClientError>> + Send + 'async_trait>> where
T: 'async_trait,
R: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Self: '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
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