Hello everyone, I’m trying to setup a connection between a browser (WASM) and a desktop client using websockets as the transport, this is what I have so far.
With all this in place, when the browser client tries to connect to the desktop client I start getting errors in the browser console:
Uncaught (in promise) TypeError: Illegal invocation at __wbg_clearTimeout_5b4145302d77e5f3 (app.js:921:128) at gloo_timers::callback::clear_timeout::he3ba6cd2af4169c5 (504de782943406928503.module.wasm:0x602c2c) at <gloo_timers::callback::Timeout as core::ops::drop::Drop>::drop::h8acab6ff95da9e30 (504de782943406928503.module.wasm:0x5b0f89) at core::ptr::drop_in_place<gloo_timers::callback::Timeout>::ha8c67498ae8bdbd9 (504de782943406928503.module.wasm:0x5fc61a) at core::ptr::drop_in_place<gloo_timers::future::TimeoutFuture>::h6b5b1c7dd8b208d5 (504de782943406928503.module.wasm:0x5fc58d) at core::ptr::drop_in_place<alloc::boxed::Box<gloo_timers::future::TimeoutFuture>>::h02b74368ff432dac (504de782943406928503.module.wasm:0x5fac58) at <send_wrapper::SendWrapper<T> as core::ops::drop::Drop>::drop::h37d540aba2b1854b (504de782943406928503.module.wasm:0x55b01d) at core::ptr::drop_in_place<send_wrapper::SendWrapper<gloo_timers::future::TimeoutFuture>>::hd6e1468839135512 (504de782943406928503.module.wasm:0x614555) at core::ptr::drop_in_place<futures_timer::wasm::Delay>::hb662a28372717eda (504de782943406928503.module.wasm:0x614521) at core::ptr::drop_in_place<libp2p_ping::handler::Handler>::h1674f59f62d20874 (504de782943406928503.module.wasm:0x5aa5e6)
This seems to be related to the usage of
libp2p-ping, replacing them with the
wasm_timer equivalents these errors are fixed. There are other errors related to timeouts and instant.now in other crates, but again replacing with
wasm_timer equivalents fixes them.
I’ve seen that in this PR wasm-timer support was removed and as I understand it all should be working fine without it. So, what am I missing, how can I make this simple example work with the current code without reverting to use wasm_timer? Any help is more than welcome thanks!