Struct jsonrpsee::PendingSubscriptionSink
source · 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>>)
pub async fn reject(self, err: impl Into<ErrorObject<'static>>)
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
.
sourcepub fn connection_id(&self) -> ConnectionId
pub fn connection_id(&self) -> ConnectionId
Returns connection identifier, which was used to perform pending subscription request
sourcepub fn max_capacity(&self) -> usize
pub fn max_capacity(&self) -> usize
Get the max capacity of the channel.
sourcepub fn method_name(&self) -> &str
pub fn method_name(&self) -> &str
Get the method name.