-
Notifications
You must be signed in to change notification settings - Fork 245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rpc: Expose the subscription ID
for RpcClientT
#733
Conversation
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
Signed-off-by: Alexandru Vasile <[email protected]>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@@ -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; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is configurable in substrate via the SubscriptionIdProvider
so it could something different than String. Should be String 99% of cases anyway but just saying.
Does the new rpc api v2
specify the format of the subscription ID? :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The RPC layer should take the subscriptionID
as a parameter in string format. From chainHead_unstable_body:
followSubscription: An opaque string that was returned by chainHead_unstable_follow.
Signed-off-by: Alexandru Vasile <[email protected]>
Extent the
RpcClientT
to obtain the ID associated with subscriptions.To ensure that this extension is not impacting users that do not want to
implement/return it, the subscription ID is optional.
The subscription ID needs to be exposed for implementing #732.