Trait substrate_rpc_client::SubscriptionClientT

source ·
pub trait SubscriptionClientT: ClientT {
    // Required methods
    fn subscribe<'a, 'life0, 'async_trait, Notif, Params>(
        &'life0 self,
        subscribe_method: &'a str,
        params: Params,
        unsubscribe_method: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             'life0: 'async_trait,
             Params: ToRpcParams + Send + 'async_trait,
             Notif: DeserializeOwned + 'async_trait,
             Self: 'async_trait;
    fn subscribe_to_method<'a, 'life0, 'async_trait, Notif>(
        &'life0 self,
        method: &'a str,
    ) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             'life0: 'async_trait,
             Notif: DeserializeOwned + 'async_trait,
             Self: 'async_trait;
}
Expand description

JSON-RPC client interface that can make requests, notifications and subscriptions.

Required Methods§

source

fn subscribe<'a, 'life0, 'async_trait, Notif, Params>( &'life0 self, subscribe_method: &'a str, params: Params, unsubscribe_method: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Params: ToRpcParams + Send + 'async_trait, Notif: DeserializeOwned + 'async_trait, Self: 'async_trait,

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.

source

fn subscribe_to_method<'a, 'life0, 'async_trait, Notif>( &'life0 self, method: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Notif: DeserializeOwned + 'async_trait, Self: 'async_trait,

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.

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<B, S> SubscriptionClientT for HttpClient<S>
where S: Send + Sync + Clone + Service<Request<Body>, Response = Response<B>, Error = Error>, <S as Service<Request<Body>>>::Future: Send, B: Body<Data = Bytes> + Send + Unpin + 'static, <B as Body>::Data: Send, <B as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

source§

fn subscribe<'a, 'life0, 'async_trait, N, Params>( &'life0 self, _subscribe_method: &'a str, _params: Params, _unsubscribe_method: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Subscription<N>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, Params: ToRpcParams + Send + 'async_trait, N: DeserializeOwned + 'async_trait, HttpClient<S>: 'async_trait,

Send a subscription request to the server. Not implemented for HTTP; will always return Error::HttpNotImplemented.

source§

fn subscribe_to_method<'a, 'life0, 'async_trait, N>( &'life0 self, _method: &'a str, ) -> Pin<Box<dyn Future<Output = Result<Subscription<N>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, 'life0: 'async_trait, N: DeserializeOwned + 'async_trait, HttpClient<S>: 'async_trait,

Subscribe to a specific method. Not implemented for HTTP; will always return Error::HttpNotImplemented.

Implementors§