Skip to content

Subscriptions close once a client is dropped #1591

@A-Manning

Description

@A-Manning

jsonrpsee_core::client::Subscription closes once the client used to subscribe is dropped. This is surprising, and not documented clearly.

IMO Subscription should have a lifetime parameter from the client, and generated client subscription methods should look something like

#[async_trait]
pub trait RpcClient: SubscriptionClient {
    ...
    // Subscription method returns `Subscription` object in case of success.
    async fn sub<'a>(&'a self) -> Result<Subscription<'a, Self, String>, Error> {
        // ...
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions