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

Is this project dead? #21

Open
whizsid opened this issue Jan 6, 2023 · 8 comments
Open

Is this project dead? #21

whizsid opened this issue Jan 6, 2023 · 8 comments

Comments

@whizsid
Copy link

whizsid commented Jan 6, 2023

I would like to add WASM support to https://github.com/google/tarpc crate by using this crate for wasm targets. But seems like this project was dead. Can anyone mention it officially?

@stan-irl
Copy link

yeah @tomaka it would be great if you could review some of the incoming PRs or hand it off to a willing maintainer.

Its a great library and the ecosystem really needs it, but in its current state its hard to justify using it

@tomaka
Copy link
Owner

tomaka commented Jan 12, 2023

I recommend against using this project. It is and has never been anything more than a quick hack while a proper solution is to be found, which is why it has no proper readme and I have never even talked about this crate publicly or on any solution media or anywhere in fact.

There exists two clean solutions that are better than this crate:

  • Using wasm32-wasi
  • Making your code entirely no_std and let the user manually plug the time input

I am not willing to spend time on, sorry to call it like that, "administrative bullshit". Getting a source of time in a cross-platform way shouldn't require any maintenance. If it does, it indicates something fundamentally wrong somewhere. All the people complaining about the lack of maintenance of this project are free to waste their energy and can fork this crate (it is under the MIT license, one of the most permissive) and publish their alternative.

@stan-irl
Copy link

thats totally fair. thankyou for clarifying

@stan-irl
Copy link

for others who find their way here. i'd suggest time-rs. It works nicely on wasm.

@whizsid
Copy link
Author

whizsid commented Mar 27, 2023

@stan-irl time-rs is using for a different purpose such as formatting, parsing and manipulating dates. But the wasm-timer supporting intervals, delays and all the tokio related time functions. I could not find any alternative at the time. So I started to manage a hard-fork of this project (wasmtimer). Also I improved it to support Web Workers, Node JS, serde.

@tomaka
Copy link
Owner

tomaka commented Mar 27, 2023

For anyone reading this issue, also be aware using setTimeout is extremely hacky, for reasons explained here: https://developer.mozilla.org/en-US/docs/Web/API/setTimeout#timeouts_in_inactive_tabs

I can't stress enough: do not just assume that WebAssembly in browsers can do timers. You will have issues. For all purposes, assume that timers simply do not exist in browser wasm.

@stan-irl
Copy link

yeah sorry you're right @whizsid. also time-rs is just a wrapper around std::time and panics at runtime anyway I just realised.

Your wasmtimer package is working great! thanks for taking ownership of the project!! 😄

@youngjoon-lee
Copy link

youngjoon-lee commented May 10, 2023

@stan-irl time-rs is using for a different purpose such as formatting, parsing and manipulating dates. But the wasm-timer supporting intervals, delays and all the tokio related time functions. I could not find any alternative at the time. So I started to manage a hard-fork of this project (wasmtimer). Also I improved it to support Web Workers, Node JS, serde.

I also forked this repo with a super simple change: youngjoon-lee@15e8835.
I just used instant::Instant, which is WASM-compatible, instead of std::time::Instant and crate::wasm::Instant And, I removed the entire crate::wasm module. So, the wasm_timer::Interval now uses instant::Instant. This works with both non-wasm and wasm32.

You can see detailed explanation in my blog: https://oudwud.dev/posts/2305102345-made-rust-libp2p-gossipsub-work-in-wasm/

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

No branches or pull requests

4 participants