-
Notifications
You must be signed in to change notification settings - Fork 978
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
feat(webrtc): add WebRTC for WASM environments #4248
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for pushing this effort forward!
I made some high-level comments regarding the design, no deeper look yet :)
Ok I have
What data are we referring to? Does the first "empty" count as first data? Or does first data exclude empty and really means the first I ask because in Noise the initiator sends first, but it is an empty send rust-libp2p/transports/noise/src/lib.rs Lines 210 to 211 in c86b665
and then of course the other option in the reverse direction: rust-libp2p/transports/noise/src/lib.rs Lines 186 to 187 in c86b665
From the browser perspective we are dialing the server, which I would expect to be an Thanks! 😀 |
Does this module help? https://github.com/libp2p/rust-libp2p/blob/master/transports/webrtc/src/tokio/upgrade/noise.rs Essentially, the upgrades are "reversed", i.e. the connection initiator uses the inbound noise upgrade and vice versa. This seems like something that we shouldn't duplicate between the two implementations so we might after all need that |
What made me rewrite this is the following sentence in the docs:
As far as I understand, this would never be cleaned up properly if we use Maybe leaking the memory and having the browser do GC could also work. After all, the connection should also get cleaned up there eventually. However, I think because we have an opportunity to correctly track for how long the closure should be alive, I opted for not calling Regarding the example: My interpretation would be that it is just that, an example, and thus not entirely clean in a way that you'd do it for a production application. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as resolved.
Judging by your recent merges into this pull request, I am guessing you want this merged? I resolved an old conversation. Still needs an approval. |
I just wanted CI to be fully green. This is ready to merge from my end but I wrote some of the code too so would appreciate a review from your end! |
Sorry for being a bit MIA (missing in action) this week, we've had a hurricane, lost power, I got a new machine, and I've switched to neovim (oh man, the learning curve) all in one week (in addition to everything else!). I finally reverted the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This pull request looks good to me.
Great work @DougAnderson444 and @thomaseizinger!
@DougAnderson444 @thomaseizinger I think this is a huge step. Does either of you want to do a quick post in the #libp2p-implementers channel, inviting folks to try out the new example? Happy to do it myself, but I don't want to steal your thunder! In addition, though that is a bit more involved, I am sure many people would enjoy a short blog post on https://github.com/libp2p/blog/. |
@DougAnderson444 Please post if you are keen, you got this off the ground!
I am happy to work on a post :) Something along the lines of "fullstack Rust libp2p"? |
I would be honored to post this merge announcement! |
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 <thomas@eizinger.io>
Sounds catchy 👍 |
Created an issue for the blog post here: libp2p/blog#113 |
Description
This PR implements
Transport
for WebRTC for browsers by using web-sys. Only thewebrtc-direct
spec is implemented. Thewebrtc
spec for connecting two browsers with each other is left to a future PR.Related: libp2p/specs#475.
Related #2617.
Supersedes: #4229.
Attributions
Co-authored-by: Thomas Eizinger thomas@eizinger.io
Notes & open questions
I wanted to put this here so that if there are any others working towards Rust WebRTC Transport in the browser they will see this started. 💯no-silos🕳️
✔This PR is in the process of being finalized & reviewed for merging (hopefully "Soon" -- it's a big PR).
ToDo
MVP
Enhancements
libp2p-webrtc-utils
)Future PR (See: #4389)
onclose
)ip4
fail vsip6
succeeding in same local machine interop testing for webrtcChange checklist