pub trait OnNewSubscription {
type Index;
type Event;
// Required method
fn on_new_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 [&'life2 Self::Index],
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Event>, String>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait;
}
Expand description
On New Subscription trait
This trait is optional and it is used to notify the application when a new subscription is created. This is useful when the application needs to send the initial state to the subscriber upon subscription
Required Associated Types§
Required Methods§
Sourcefn on_new_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 [&'life2 Self::Index],
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Event>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
fn on_new_subscription<'life0, 'life1, 'life2, 'async_trait>(
&'life0 self,
request: &'life1 [&'life2 Self::Index],
) -> Pin<Box<dyn Future<Output = Result<Vec<Self::Event>, String>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
'life2: 'async_trait,
Called when a new subscription is created