-
Notifications
You must be signed in to change notification settings - Fork 45
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
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
crodas
force-pushed
the
web-socket-for-wallet
branch
7 times, most recently
from
November 27, 2024 14:51
2ff8f0b
to
8990de4
Compare
crodas
force-pushed
the
web-socket-for-wallet
branch
4 times, most recently
from
November 28, 2024 11:54
259d800
to
3e3fa23
Compare
crodas
force-pushed
the
web-socket-for-wallet
branch
2 times, most recently
from
November 30, 2024 18:05
73afc03
to
cc155a9
Compare
2 tasks
thesimplekid
requested changes
Dec 1, 2024
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.
Great work just a few comments.
crodas
force-pushed
the
web-socket-for-wallet
branch
3 times, most recently
from
December 4, 2024 23:40
b514281
to
34bd97b
Compare
thesimplekid
reviewed
Dec 5, 2024
crodas
force-pushed
the
web-socket-for-wallet
branch
2 times, most recently
from
December 5, 2024 17:58
f3f5d32
to
04d38ef
Compare
crodas
force-pushed
the
web-socket-for-wallet
branch
from
December 5, 2024 20:45
47e0d58
to
2c3b683
Compare
crodas
added a commit
to crodas/cdk
that referenced
this pull request
Dec 6, 2024
crodas
added a commit
to crodas/cdk
that referenced
this pull request
Dec 6, 2024
crodas
force-pushed
the
web-socket-for-wallet
branch
from
December 6, 2024 16:38
641c301
to
b8171ab
Compare
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. Fixed bug with Default as described in cashubtc#473 (comment)
thesimplekid
force-pushed
the
web-socket-for-wallet
branch
from
December 8, 2024 16:29
b8171ab
to
760564c
Compare
thesimplekid
approved these changes
Dec 8, 2024
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.
ACK 2462168
vnprc
pushed a commit
to vnprc/cdk
that referenced
this pull request
Dec 18, 2024
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. Fixed bug with Default as described in cashubtc#473 (comment)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Description
The last bit missing to wrap up #442
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 implementsActiveSubscription.
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. ThisSubscriptionClient
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. WhenActiveSubscription
is dropped, it will automatically unsubscribe.Notes to the reviewers
Suggested CHANGELOG Updates
Added Websocket subscription to the Wallet.
CHANGED
ADDED
REMOVED
FIXED
Checklist
just final-check
before committing