Trait jsonrpsee_http_client::traits::SubscriptionClient[][src]

pub trait SubscriptionClient: Client {
    #[must_use]
    fn subscribe<'a, 'life0, 'async_trait, Notif>(
        &'life0 self,
        subscribe_method: &'a str,
        params: JsonRpcParams<'a>,
        unsubscribe_method: &'a str
    ) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + 'async_trait + Send, Global>>
    where
        'a: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait,
        Notif: DeserializeOwned + 'async_trait
;
#[must_use] fn register_notification<'a, 'life0, 'async_trait, Notif>(
        &'life0 self,
        method: &'a str
    ) -> Pin<Box<dyn Future<Output = Result<NotificationHandler<Notif>, Error>> + 'async_trait + Send, Global>>
    where
        'a: 'async_trait,
        'life0: 'async_trait,
        Self: 'async_trait,
        Notif: DeserializeOwned + 'async_trait
; }
Expand description

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

Required methods

#[must_use]
fn subscribe<'a, 'life0, 'async_trait, Notif>(
    &'life0 self,
    subscribe_method: &'a str,
    params: JsonRpcParams<'a>,
    unsubscribe_method: &'a str
) -> Pin<Box<dyn Future<Output = Result<Subscription<Notif>, Error>> + 'async_trait + Send, Global>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait,
    Notif: DeserializeOwned + 'async_trait, 
[src]

Send a subscription request to the server, technically not part of the JSON-RPC specification

The subscribe_method and params are used to ask for the subscription towards the server.

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.

#[must_use]
fn register_notification<'a, 'life0, 'async_trait, Notif>(
    &'life0 self,
    method: &'a str
) -> Pin<Box<dyn Future<Output = Result<NotificationHandler<Notif>, Error>> + 'async_trait + Send, Global>> where
    'a: 'async_trait,
    'life0: 'async_trait,
    Self: 'async_trait,
    Notif: DeserializeOwned + 'async_trait, 
[src]

Register a NotificationHandler that will listen for incoming JSON-RPC notifications

Implementors