pub struct PendingSubscriptionSink { /* private fields */ }Expand description
Represents a single subscription that is waiting to be accepted or rejected.
If this is dropped without calling PendingSubscription::reject or PendingSubscriptionSink::accept
a default error is sent out as response to the subscription call.
Thus, if you want a customized error message then PendingSubscription::reject must be called.
Implementations§
source§impl PendingSubscriptionSink
impl PendingSubscriptionSink
sourcepub async fn reject(
self,
err: impl Into<ErrorObject<'static>>
) -> impl Future<Output = ()>
pub async fn reject( self, err: impl Into<ErrorObject<'static>> ) -> impl Future<Output = ()>
Reject the subscription by responding to the subscription method call with
the error message from jsonrpsee_types::error::ErrorObject.
Note
If this is used in the async subscription callback the return value is simply ignored because no further notification are propagated once reject has been called.
sourcepub async fn accept(
self
) -> impl Future<Output = Result<SubscriptionSink, PendingSubscriptionAcceptError>>
pub async fn accept( self ) -> impl Future<Output = Result<SubscriptionSink, PendingSubscriptionAcceptError>>
Attempt to accept the subscription and respond the subscription method call.
Panics
Panics if the subscription response exceeded the max_response_size.
sourcepub fn connection_id(&self) -> usize
pub fn connection_id(&self) -> usize
Returns connection identifier, which was used to perform pending subscription request