pub trait SubscriptionClientT: ClientT {
// Required methods
fn subscribe<'a, Notif, Params>(
&self,
subscribe_method: &'a str,
params: Params,
unsubscribe_method: &'a str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
where Params: ToRpcParams + Send,
Notif: DeserializeOwned;
fn subscribe_to_method<Notif>(
&self,
method: &str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
where Notif: DeserializeOwned;
}client only.Expand description
JSON-RPC client interface that can make requests, notifications and subscriptions.
Required Methods§
Sourcefn subscribe<'a, Notif, Params>(
&self,
subscribe_method: &'a str,
params: Params,
unsubscribe_method: &'a str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
fn subscribe<'a, Notif, Params>( &self, subscribe_method: &'a str, params: Params, unsubscribe_method: &'a str, ) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Send
Initiate a subscription by performing a JSON-RPC method call where the server responds with
a Subscription ID that is used to fetch messages on that subscription,
The subscribe_method and params are used to ask for the subscription towards the
server.
The params may be used as input for the subscription for the server to process.
The unsubscribe_method is used to close the subscription
The Notif param is a generic type to receive generic subscriptions, see Subscription for further
documentation.
Sourcefn subscribe_to_method<Notif>(
&self,
method: &str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Sendwhere
Notif: DeserializeOwned,
fn subscribe_to_method<Notif>(
&self,
method: &str,
) -> impl Future<Output = Result<Subscription<Notif>, Error>> + Sendwhere
Notif: DeserializeOwned,
Register a method subscription, this is used to filter only server notifications that a user is interested in.
The Notif param is a generic type to receive generic subscriptions, see Subscription for further
documentation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementors§
impl<L> SubscriptionClientT for Client<L>where
L: RpcServiceT<MethodResponse = Result<MiddlewareMethodResponse, Error>, BatchResponse = Result<MiddlewareBatchResponse, Error>, NotificationResponse = Result<MiddlewareNotifResponse, Error>> + Send + Sync,
async-client and async-wasm-client only.