Closed tchardin closed 2 years ago
for reference should pass an executor to the swarm that is compatible with wasm. For instance:
let mut swarm = SwarmBuilder::new(transport, behaviour, local_peer_id)
.executor(Box::new(|fut| {
wasm_bindgen_futures::spawn_local(fut);
}))
.build();
delete
let mut yamux_config = yamux::YamuxConfig::default();
yamux_config.set_max_buffer_size(16 * 1024 * 1024);
yamux_config.set_receive_window_size(16 * 1024 * 1024);
core::upgrade::SelectUpgrade::new(yamux_config, mplex_config)
as SelectUpgrade
seems to hang forever in the browser. Multiplexer should just be the default mplex::MplexConfig::new()
Building wasm:
wasm-pack build --target web --out-dir web/src/wasm -- --features browser --no-default-features
. This will make sure the right JS files are generated directly in the JS source directory./web/src/wasm/pop_bg.wasm
to/web/public/pop_bg.wasm
for it to load properly as it is served separately./web
and runnpm run start
then openhttp://localhost:8000
in an incognito window (helps register a new service worker each time otherwise you will be running the previous service worker when reloading the page and changes won't take effect).Blockers:
Failed to create executor thread pool: Error { kind: Unsupported, message: "operation not supported on this platform" }
. Not sure what is causing it, I wasn't aware of a thread pool usage anywhere.