-
Notifications
You must be signed in to change notification settings - Fork 984
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 support #2617
Comments
A different kind of WASM support I'd like to bring to the table and something I'd like to experiment in the coming months(ideas and help will be welcomed) is the definition of a WASI interface that can be proposed later as The proposal I mention is not so much for the browser support or environments that usually run a single bigger WASM blob where libp2p is included, my use case is embedded hardware where I want to allow a very constrained device to run a lightweight WASM interpreter like WASM3 and run many plugins that need to be as lightweight as possible, in systems where 1Mb is a lot and all there is I want to squeeze as many of those plugins as possible. |
These are some very interesting and exciting ideas! Here are some thoughts on it:
Another advantage of this approach is that with the |
I have implemented a version of the chat example with libp2p WASM clients running in the browser connecting to a Floodsub server using a Websocket transport: I added the steps to build and run it in the repo. To make deployment easier I have implemented a Websocket transport that uses Websys so that there is no need to package JS bindings and you can build a 100% rust client with a UI library like egui. Keep in mind that I didn't do any serious testing, this is more of a proof of concept to test libp2p WASM support and get some feedback, I am happy to help and contribute any of this to libp2p if you think it may help. |
Wonderful work @vincev. Thanks for the elaborate
Yes. That would be great! Off the top of my head I am thinking of moving a version of https://github.com/vincev/wasm-p2p-chat into |
Thanks @mxinden I am glad you like it.
Sounds good to me, another option would be to have an examples folder for WASM browser apps that would include examples for Websocket and WebCRT but I guess that can be done later. |
Could be an opportunity to move towards #3111. |
This comment was marked as outdated.
This comment was marked as outdated.
💯 Full stack is definitely appealing! I'm looking forward to being able to use protocols like gossipsub isomorphically in the browser and server, not having to trouble shoot or be familiar with 2 different implementations (Rust and Javascript) -- a real bonus. |
This PR implements `Transport` for WebRTC for browsers by using web-sys. Only the `webrtc-direct` spec is implemented. The `webrtc` spec for connecting two browsers with each other is left to a future PR. Related: libp2p/specs#475. Related #2617. Supersedes: #4229. Pull-Request: #4248. Co-authored-by: Thomas Eizinger <[email protected]>
Changelog: I've updated the PR description to reflect the current state and deleted several of the old points which I found not to be actionable. |
This PR implements `Transport` for WebRTC for browsers by using web-sys. Only the `webrtc-direct` spec is implemented. The `webrtc` spec for connecting two browsers with each other is left to a future PR. Related: libp2p/specs#475. Related #2617. Supersedes: #4229. Pull-Request: #4248. Co-authored-by: Thomas Eizinger <[email protected]>
This issue is an attempt to gather information relating to WASM support for rust-libp2p as well as serve as somewhat of a tracking / discussion issue.
Transports
The general approach that we've been taking for transports it to use the
web-sys
bindings and code against those directly. This allows us to stay in Rust land without having to write any JS. Additionally, the acceptance criteria for any further transport is that they are integrated in the interop-test suite.Testing
We have additional tests that go beyond the interop suite in the
wasm-tests
directory: https://github.com/libp2p/rust-libp2p/tree/master/wasm-testsTasks
libp2p-wasm-ext
withlibp2p-websocket-websys
#3611webrtc
protocol for browser-to-browser communication #4389Previous Implementations of WASM libp2p
The text was updated successfully, but these errors were encountered: