pub trait PubsubTransport: Transport {
type NotificationStream: Stream<Item = SubscriptionNotification>;
// Required methods
fn subscribe<'life0, 'async_trait, M>(
&'life0 self,
subscribe_method: M,
params: Option<Params>,
) -> Pin<Box<dyn Future<Output = Result<(Id, Self::NotificationStream), Self::Error>> + Send + 'async_trait>>
where M: Into<String> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
fn unsubscribe<'life0, 'async_trait, M>(
&'life0 self,
unsubscribe_method: M,
subscription_id: Id,
) -> Pin<Box<dyn Future<Output = Result<bool, Self::Error>> + Send + 'async_trait>>
where M: Into<String> + Send + 'async_trait,
Self: 'async_trait,
'life0: 'async_trait;
}
Expand description
A JSON-RPC 2.0 transport supporting subscriptions.
Required Associated Types§
Sourcetype NotificationStream: Stream<Item = SubscriptionNotification>
type NotificationStream: Stream<Item = SubscriptionNotification>
The subscription stream.
Required Methods§
Sourcefn subscribe<'life0, 'async_trait, M>(
&'life0 self,
subscribe_method: M,
params: Option<Params>,
) -> Pin<Box<dyn Future<Output = Result<(Id, Self::NotificationStream), Self::Error>> + Send + 'async_trait>>
fn subscribe<'life0, 'async_trait, M>( &'life0 self, subscribe_method: M, params: Option<Params>, ) -> Pin<Box<dyn Future<Output = Result<(Id, Self::NotificationStream), Self::Error>> + Send + 'async_trait>>
Add a subscription to this transport.
Will send unsubscribe request to the server when drop the notification stream.
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.