rpc: Extend RpcClientT to return the subscription ID

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
Alexandru Vasile
2022-11-24 16:58:38 +00:00
parent 8b489a788c
commit 9f7d95b898
2 changed files with 5 additions and 1 deletions
+1
View File
@@ -69,6 +69,7 @@ pub use rpc_client_t::{
RpcClientT,
RpcFuture,
RpcSubscription,
RpcSubscriptionId,
};
pub use rpc_client::{
+4 -1
View File
@@ -52,7 +52,7 @@ pub trait RpcClientT: Send + Sync + 'static {
sub: &'a str,
params: Option<Box<RawValue>>,
unsub: &'a str,
) -> RpcFuture<'a, RpcSubscription>;
) -> RpcFuture<'a, (RpcSubscription, Option<RpcSubscriptionId>)>;
}
/// A boxed future that is returned from the [`RpcClientT`] methods.
@@ -62,3 +62,6 @@ pub type RpcFuture<'a, T> =
/// The inner subscription stream returned from our [`RpcClientT`]'s `subscription` method.
pub type RpcSubscription =
Pin<Box<dyn Stream<Item = Result<Box<RawValue>, RpcError>> + Send + 'static>>;
/// The ID associated with the [`RpcClientT`]'s `subscription`.
pub type RpcSubscriptionId = String;