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

NUT-17: WebSocket updates #202

Open
wants to merge 57 commits into
base: development
Choose a base branch
from
Open

NUT-17: WebSocket updates #202

wants to merge 57 commits into from

Conversation

Egge21M
Copy link
Collaborator

@Egge21M Egge21M commented Nov 4, 2024

Fixes: none

Description

This adds WebSocket management, as well as a couple of methods on CashuWallet for full NUT-17 support

Changes

  • Added WSConnection Class
  • Handle automatic connects and reconnects
  • Added Message Queue
  • Added CashuWallet methods
  • Added unit and integration tests

PR Tasks

  • Open PR
  • run npm run test --> no failing unit tests
  • run npm run format

@Egge21M Egge21M changed the title NUT-17: WebSocket updates [WIP] NUT-17: WebSocket updates Nov 4, 2024
@Egge21M Egge21M mentioned this pull request Nov 4, 2024
3 tasks
@Egge21M Egge21M changed the title [WIP] NUT-17: WebSocket updates NUT-17: WebSocket updates Nov 4, 2024
@Egge21M Egge21M requested a review from gudnuf November 4, 2024 19:43
src/CashuWallet.ts Outdated Show resolved Hide resolved
export class WSConnection {
public readonly url: URL;
private readonly _WS: typeof WebSocket;
private ws: WebSocket | undefined;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should these private fields be prefixed by _? like the classes in utils?

src/WSConnection.ts Show resolved Hide resolved
}
}
} catch (e) {
console.log(e);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this try to call the errorCallback?

};

type JsonRpcSuccess<T = any> = {
jsonrpc: '2.0';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe make jsonrpc readonly, to make sure the editor doesn't display the type as string

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants