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

Wasm #192

Closed
jimmywarting opened this issue Sep 15, 2023 · 6 comments
Closed

Wasm #192

jimmywarting opened this issue Sep 15, 2023 · 6 comments

Comments

@jimmywarting
Copy link

I digged into the construction of this, and upon examination, it appears to be utilizing NodeJS bindings. However, I believe there is room for improvement by transitioning this to WebAssembly.

By doing so, not only would it function seamlessly on NodeJS, but it could potentially be executed on Deno, Bun, and various other runtimes as well(?) It would simplify the distribution process, as we could distribute one single pre-compiled WebAssembly file that operates on any runtime or machine, eliminating the need for source code compilation upon installing the package.

While inspecting the source code on npm, I also noticed it includes cmake, src, test, and heck even node_modules (which might have been unintentional?). Consolidating everything into a single WebAssembly file would result in a fully cross-compatible executable and also being easier to install

toughts?

@murat-dogan
Copy link
Owner

Something like that;
https://github.com/paullouisageneau/datachannel-wasm

Yes package on npm includes test, src folders. They are just small files. prebuild-install was a bundleddep so you see node_modules folder.
But nowadays it does not make sense to use a bundleddep. I have just deleted it.
Thanks for reporting.

@jimmywarting
Copy link
Author

jimmywarting commented Sep 15, 2023

Something like that;
https://github.com/paullouisageneau/datachannel-wasm

Uh, interesting 🥸

@jimmywarting
Copy link
Author

jimmywarting commented Sep 15, 2023

lul paullouisageneau/datachannel-wasm#43 (comment)

A: hey check out B instead
B: hey check out A instead

NodeJS and other runtimes have globalThis.WebAssembly how hard can it be? 🙃

@ThaUnknown
Copy link
Contributor

ThaUnknown commented Sep 15, 2023

bun supports node bindings? idk about deno, wasm is also insanely slower than native bindings, so is there really a point?

its actually insanely hard to create bindings for C libraries like this with WASM, I have tried, and it's a lot more work than you'd expect

@paullouisageneau
Copy link
Contributor

@jimmywarting Porting libdatachannel to WASI sounds like a lot of work, if it is even possible, given that the library and its dependencies rely on a lot of POSIX or OS-specific system APIs, in particular for network access and threading.

@jimmywarting
Copy link
Author

yea, WASI is probably the right thing for it...
i just wish that deno, bun and nodejs could support it right from the core.
having global WebRTC DataChannel globally would be amazing!

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