mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-13 10:31:04 +00:00
rpc: Expose the subscription ID for RpcClientT (#733)
* rpc: Extend `RpcClientT` to return the subscription ID Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Return `RpcSubscriptionId` for jsonrpsee clients Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Expose subscription ID via subxt subscription Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * examples: Adjust example to return subscription ID Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> * rpc: Add structure for subscription stream and subscription id Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io> Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
This commit is contained in:
@@ -59,6 +59,17 @@ pub trait RpcClientT: Send + Sync + 'static {
|
||||
pub type RpcFuture<'a, T> =
|
||||
Pin<Box<dyn Future<Output = Result<T, RpcError>> + Send + 'a>>;
|
||||
|
||||
/// The RPC subscription returned from [`RpcClientT`]'s `subscription` method.
|
||||
pub struct RpcSubscription {
|
||||
/// The subscription stream.
|
||||
pub stream: RpcSubscriptionStream,
|
||||
/// The ID associated with the subscription.
|
||||
pub id: Option<RpcSubscriptionId>,
|
||||
}
|
||||
|
||||
/// The inner subscription stream returned from our [`RpcClientT`]'s `subscription` method.
|
||||
pub type RpcSubscription =
|
||||
pub type RpcSubscriptionStream =
|
||||
Pin<Box<dyn Stream<Item = Result<Box<RawValue>, RpcError>> + Send + 'static>>;
|
||||
|
||||
/// The ID associated with the [`RpcClientT`]'s `subscription`.
|
||||
pub type RpcSubscriptionId = String;
|
||||
|
||||
Reference in New Issue
Block a user