Struct jsonrpsee_core::server::PendingSubscriptionSink
source · pub struct PendingSubscriptionSink { /* private fields */ }
server
only.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<ErrorObjectOwned>)
pub async fn reject(self, err: impl Into<ErrorObjectOwned>)
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
) -> Result<SubscriptionSink, PendingSubscriptionAcceptError>
pub async fn accept( self ) -> 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
.