Skip to content
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

Introduce subscription support in the Wallet crate. #473

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Commits on Nov 30, 2024

  1. Introduce subscription support in the Wallet crate.

    The main goal is to add a subscription to CDK Mint updates into the wallet.
    This feature will be particularly useful for improving the code whenever loops
    hit the mint server to check status changes.
    
    The goal is to add an easy-to-use interface that will hide the fact that we're
    connecting to WebSocket and subscribing to events. This will also hide the fact
    that the CDK-mint server may not support WebSocket updates.
    
    To be fully backward compatible, the HttpClientMethods traits have a new
    method, `subscribe,` which will return an object that implements
    `ActiveSubscription.`
    
    In the primary implementation, there is a `SubscriptionClient` that will
    attempt to connect through WebSocket and will fall to the HTTP-status pull and
    sleep approach (the current approach), but upper stream code will receive
    updates as if they come from a stream of updates through WebSocket. This
    `SubscriptionClient` struct will also manage reconnections to WebSockets (with
    automatic resubscriptions) and all the low-level stuff, providing an
    easy-to-use interface and leaving the upper-level code with a nice interface
    that is hard to misuse. When `ActiveSubscription` is dropped, it will
    automatically unsubscribe.
    crodas committed Nov 30, 2024
    Configuration menu
    Copy the full SHA
    cc155a9 View commit details
    Browse the repository at this point in the history