Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@Frando
Copy link
Member

@Frando Frando commented Nov 3, 2025

Description

Make iroh-docs work in WebAssembly in the browser, memstore only.

  • Has the usual changes to use n0-future for time and tasks.
  • redb works in-memory in the browser. No persistent store for now. In native environments, we spawn a separate thread for the storage actor with a single-threaded tokio runtime. In wasm, we instead simply run this on the main thread. With the inmemory store this is fine, IMO.
  • This PR includes a refactor that was needed anyway: A couple of methods on Replica are now async because we previously used send_blocking on a async_channel::Sender (uuh) and async_channel::Sender::send_blocking is not available on wasm.

Breaking Changes

Made a couple of methods on Replica async because we previously used send_blocking on a async_channel::Sender (uuh) and async_channel::Sender::send_blocking is not available on wasm. This is a much needed refactor anyways.

(needs more details)

Notes & open questions

Change checklist

  • Self-review.
  • Documentation updates following the style guide, if relevant.
  • Tests if relevant.
  • All breaking changes documented.

@n0bot n0bot bot added this to iroh Nov 3, 2025
@github-project-automation github-project-automation bot moved this to 🏗 In progress in iroh Nov 3, 2025
@Frando Frando force-pushed the Frando/wasm branch 2 times, most recently from 817309b to 42d921f Compare November 3, 2025 13:47
@github-actions
Copy link

github-actions bot commented Nov 3, 2025

Documentation for this PR has been generated and is available at: https://n0-computer.github.io/iroh-docs/pr/75/docs/iroh_docs/

Last updated: 2025-11-11T22:58:19Z

@Frando Frando marked this pull request as ready for review November 3, 2025 14:55
@Frando Frando changed the title (wip) feat: build on wasm feat: build on wasm Nov 3, 2025
@b5 b5 force-pushed the Frando/wasm branch 2 times, most recently from dfd62c8 to 061ece7 Compare November 10, 2025 20:51
@b5
Copy link
Member

b5 commented Nov 10, 2025

I've taken the liberty of updating this PR, all of the upstream PRs this one depends on are now merged, we're only waiting on a release for n0-future that'll include the features this relies on.

@matheus23
Copy link
Member

n0-future 0.3.1 is released now ✌️

@Frando
Copy link
Member Author

Frando commented Nov 11, 2025

Updated to use the n0-future release. I think this is ready for merge now :)

@b5
Copy link
Member

b5 commented Nov 11, 2025

TIL if you import std::time::{Duration, Instant}, it'll compile to wasm, but browsers get very upset when either of those are used.

Pushed what is hopefully a fix, but ideally we'd have a CI check that ensures we use the n0_future::time:: variants when targeting browser wasm

@b5
Copy link
Member

b5 commented Nov 11, 2025

speaking of references to std::time: n0-computer/iroh-blobs#194

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: 🏗 In progress

Development

Successfully merging this pull request may close these issues.

4 participants