Add WASM-compatible WebSocket client abstraction #1615

Merged
crodas merged 2 commits from feature/ws-support-wasm into main 2026-02-27 15:31:37 +00:00
crodas commented 2026-02-10 00:06:00 +00:00 (Migrated from github.com)

Description

Move WebSocket dependency (tokio-tungstenite) from cdk to cdk-http-client and introduce a platform-agnostic ws module with native (tokio-tungstenite) and WASM (ws_stream_wasm) backends. This enables WebSocket subscriptions on WASM targets, which were previously gated behind cfg(not(wasm32)).

Flatten wallet subscription module by merging ws.rs into subscription.rs now that the stream client is unconditionally compiled.


Notes to the reviewers


Suggested CHANGELOG Updates

CHANGED

ADDED

REMOVED

FIXED


Checklist

### Description Move WebSocket dependency (tokio-tungstenite) from cdk to cdk-http-client and introduce a platform-agnostic ws module with native (tokio-tungstenite) and WASM (ws_stream_wasm) backends. This enables WebSocket subscriptions on WASM targets, which were previously gated behind cfg(not(wasm32)). Flatten wallet subscription module by merging ws.rs into subscription.rs now that the stream client is unconditionally compiled. ----- ### Notes to the reviewers <!-- In this section you can include notes directed to the reviewers, like explaining why some parts of the PR were done in a specific way --> ----- ### Suggested [CHANGELOG](https://github.com/cashubtc/cdk/blob/main/CHANGELOG.md) Updates <!-- Please do not edit the actual changelog but note what you changed here. --> #### CHANGED #### ADDED #### REMOVED #### FIXED ---- ### Checklist * [ ] I followed the [code style guidelines](https://github.com/cashubtc/cdk/blob/main/CODE_STYLE.md) * [ ] I ran `just final-check` before committing
crodas commented 2026-02-26 13:42:25 +00:00 (Migrated from github.com)

Can you please review this @thesimplekid ? I will follow up with a PR that would make this a trait (Http + websocket) to be passed around, deprecating the transport layer in the wallet for a generic transport layer that would be used project wise.

Can you please review this @thesimplekid ? I will follow up with a PR that would make this a trait (Http + websocket) to be passed around, deprecating the transport layer in the wallet for a generic transport layer that would be used project wise.
thesimplekid (Migrated from github.com) reviewed 2026-02-26 13:51:59 +00:00
@ -0,0 +89,4 @@
{} header(s) will be ignored.",
headers.len()
);
}
thesimplekid (Migrated from github.com) commented 2026-02-26 13:51:44 +00:00

Won't just discarding the header lead to difficult to debug errors specifically around auth? I don't think logging and just dropping is a good solution.

Won't just discarding the header lead to difficult to debug errors specifically around auth? I don't think logging and just dropping is a good solution.
crodas (Migrated from github.com) reviewed 2026-02-27 15:22:37 +00:00
@ -0,0 +89,4 @@
{} header(s) will be ignored.",
headers.len()
);
}
crodas (Migrated from github.com) commented 2026-02-27 15:22:37 +00:00

@thesimplekid Can this be handled as part of https://github.com/cashubtc/cdk/issues/1682 and merge this as is?

@thesimplekid Can this be handled as part of https://github.com/cashubtc/cdk/issues/1682 and merge this as is?
thesimplekid (Migrated from github.com) reviewed 2026-02-27 15:30:41 +00:00
@ -0,0 +89,4 @@
{} header(s) will be ignored.",
headers.len()
);
}
thesimplekid (Migrated from github.com) commented 2026-02-27 15:30:41 +00:00

Sure, but need to make sure it is fixed before 0.16.

Sure, but need to make sure it is fixed before 0.16.
thesimplekid (Migrated from github.com) approved these changes 2026-02-27 15:30:53 +00:00
Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cashubtc/cdk!1615
No description provided.