feat: Add WebSocket and WebRTC transports to relay server example#6030
Closed
r-zig wants to merge 9 commits intolibp2p:masterfrom
r-zig:feat/relay-webrtc-websocket-6029
Closed
feat: Add WebSocket and WebRTC transports to relay server example#6030r-zig wants to merge 9 commits intolibp2p:masterfrom r-zig:feat/relay-webrtc-websocket-6029
r-zig wants to merge 9 commits intolibp2p:masterfrom
r-zig:feat/relay-webrtc-websocket-6029
Conversation
elenaf9
reviewed
May 22, 2025
Member
elenaf9
left a comment
There was a problem hiding this comment.
Thanks @r-zig. Some high-level comments, but please see #6029 (comment) for the general discussion.
| @@ -0,0 +1 @@ | |||
| RUST_LOG=info cargo run -- --port 4884 --secret-key-seed 0 --websocket-port 8080 --webrtc-port 8081 No newline at end of file | |||
Member
There was a problem hiding this comment.
I appreciate the effort, but I don't think we should add run scripts that hard-code the parameters. Most user want to change these parameters anyway, and having to think about them IMO also helps the general understanding.
Contributor
Author
There was a problem hiding this comment.
Sure. I will move them to a new repo that provide examples.
examples/relay-server/Cargo.toml
Outdated
Comment on lines
+16
to
+18
| libp2p-webrtc = { workspace = true, features = ["tokio"] } | ||
| libp2p-noise = { workspace = true } | ||
| libp2p-tls = { workspace = true } |
Member
There was a problem hiding this comment.
Why not use them through the libp2p meta crate?
Contributor
Author
There was a problem hiding this comment.
Removed the tls & noise , but webrtc is not exposed via the libp2p meta crate
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
This PR addresses issue #6029 by adding WebSocket and WebRTC transport support to the relay server example.
While full WebRTC interoperability is not yet supported, these changes lay the groundwork for ongoing efforts to enable and test connectivity between peers behind different private NATs and VPNs.
This work is particularly relevant for use cases involving interoperability with other libp2p implementations, such as js-libp2p-example-webrtc-private-to-private, and is a step toward seamless connectivity between browser-based JS peers, Rust processes, and both Rust and JS relays.
Related:
libp2p/js-libp2p-examples#226.
libp2p/js-libp2p-examples#227.
Draft: WebRTC Implementation for Browser to Browser #5978
Fixes: libp2p/rust-libp2p#6029.
Notes & open questions
Change checklist