-
-
Notifications
You must be signed in to change notification settings - Fork 25
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
Compatibility with wasm #144
Comments
Please read: #53 |
duplicated |
Still it doesn't support error megalodon= {version="0.11.8"} error[E0432]: unresolved import error[E0432]: unresolved import error[E0432]: unresolved import error[E0433]: failed to resolve: could not find error[E0433]: failed to resolve: could not find error[E0433]: failed to resolve: could not find error[E0433]: failed to resolve: could not find error[E0433]: failed to resolve: could not find error[E0433]: failed to resolve: could not find |
@h3poteto would you consider re-opening this? In order for megalodon to work in wasm, I believe more functionality is required. I haven't yet managed to get |
No. |
In the last few weeks I found another library that follows a similar pattern to oauth2-rs/openidconnect-rs: https://github.com/sugyan/atrium. Atrium makes multiple network requests internally, but it's simple to provide your own implementations for the network calls. For example you can see here the relatively few lines of code necessary for me to implement my own HTTP client function for wasm32 (running in Extism): This allowed me to add Bluesky/ATProto login to my library with far less effort and increased security. I believe this is similar to the concept of sans-io development, but I'm not an expert in that. Would you be interested in adding this sort of flexibility to megalodon? |
Hmm, in the first place, why do you want to use megalodon-rs with wasm? |
I'm actually targeting backend, not frontend. I'm building an authentication library for multiple languages. Currently have it working for JS, Go, and Rust, but adding support for any of the Extism host languages (https://extism.org/) should be relatively straight forward. |
If it's backend, why do you need to use wasm instead of compiling with rust? |
You mean compile the Rust to FFI via extern C? Primarily because wasm is far more portable (especially for JS and Golang). You can run the same wasm binary unchanged on many platforms and languages. |
Sorry, I don't really get it, why do you need wasm if you're targeting the backend? |
Say I'm building a JS app and want to add ATProto login. I need to find a JS library that supports that. Next imagine I'm writing a Golang app and want to do the same thing. Now I need to find a completely different library, which likely has a different feature set. The library I'm working on works in JS, Golang, Rust, and others are easy to add. It also supports login with ATProto, Fediverse, OIDC, etc. One auth library that provides a consistent feature set and API in many languages. If I wasn't using wasm, I would have to implement each feature in every language. Using wasm I implement a feature once and it immediately works in every language. Building for wasm is the best way I've found to accomplish this. |
But to do that, each library needs to be wasm-compatible, right? |
Technically, yes. But this is becoming more and more common. ATrium and oauth2-rs already were compatible. And there are other benefits to designing APIs this way. It makes things more modular, and reduces your dependency on reqwest, while still retaining a high-level API for those who desire the default settings. But I totally get it if this isn't a priority for you. |
Hmm, I understand the situation. However, since the situation where it is needed is limited, this issue is not a high priority for me. Also, according to my investigation, the compile errors are not coming from reqwest and oauth2. Those errors are coming from tokio-tungstenite. It depends on |
Can megalodon-rs support wasm so that it can used by rust framework like yew?
The text was updated successfully, but these errors were encountered: