Conversation
|
Hey @Nkovaturient, after our discussion, I have made some changes to the SDP and ICE exchange protocols for it to be interoperable with JS.
Also, in the meantime, can you check for |
Sure, gonna fix them. |
969868f to
13378e6
Compare
|
@Nkovaturient , @sukhman-sukh : Great work :) Added some feedback on the tests proposed at #839 . Wonderful progress indeed. Reviewing the PR and looking forward to successful completion of the WebRTC direct PR in the coming days. CCing @pacrob, @Winter-Soren, @AkMo3, @acul71, @guha-rahul and @lla-dane for their feedback and pointers. Looking forward to seeing WebRTC direct in production soon :) |
1cd4b3f to
13378e6
Compare
|
Hey @seetadev, Add stream is the second last and Fix lint is the last commit |
|
Also, I am facing difficulty in some functions of listener which for now I have created as a placeholder as JS has something called |
Webrtc side branch
|
@sukhman-sukh , @Nkovaturient : Thank you for making improvements and fixing linting issues. Re-ran the CI/CD pipeline. We do have some issues that are yet to be fixed too. |
…CRawConnection and test mocks
…o-pvt - Add _hold_loop_open from start() to stop() - Wrap dial/signaling/cleanup in with_webrtc_context - Ensure data pump ready before upgrade - Example: host.connect() + new_stream() for proper upgrade
|
Hello @seetadev @acul71 @sumanjeet0012 I think I have so far fixed and covered all the remaining issues with @asmit27rai and this webrtc transport PR is ready to be reviewed. Thank you! |
…x-docs - pyproject.toml: remove [project.optional-dependencies]; keep only [dependency-groups] (PEP 735) as single source of truth. Install via uv (e.g. uv sync --group dev, uv pip install --group test -e .). - tox.ini: drop extras=; envs install only with uv pip install --group ... - Makefile: docs and linux-docs are synonyms; one recipe that runs check-docs then opens with xdg-open or open, help lists both. Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Nkovaturient @asmit27rai — short update on the recent pyproject.toml, tox, and docs (Makefile) changes: 1. uv as preferred installer (PEP 735 only)
2. Make docs / linux-docs
Rationale: avoid duplicating dependency lists (optional-dependencies vs dependency-groups) and standardise on uv + PEP 735; simplify docs targets so one implementation works everywhere. |
…tAssertRewriteWarning - connect.py: replace 'if raw_connection._handshake_failure_event:' with 'if raw_connection._handshake_failure_event is not None:' to avoid deprecated trio.Event.__bool__ (Trio 0.31+). - conftest.py: remove top-level import of relay_fixtures; lazy-import store_relay_addrs inside nat_peer_a and nat_peer_b so relay_fixtures is not loaded before pytest's assertion rewriter (fixes 24× PytestAssertRewriteWarning). Add comments explaining the lazy import. Co-authored-by: Cursor <cursoragent@cursor.com>
|
Latest commit (ef60bbc):
Tests: |
|
@Nkovaturient : Thank you for the continued efforts. Appreciate it. Also, thanks to @asmit27rai for his contribution too. Luca and I had a brief discussion on your PR. @acul71 has shared detailed feedback on your PR. Please review and make additions. Also, adding @sumanjeet0012 and @deepso from Huddle01 to the thread. Wish if you could share peer review on this PR. Ccing @pacrob. |
|
@Nkovaturient From what I understand of the WebRTC private-to-private implementation, it seems that protobuf framing is not currently being used. Instead, there appears to be an ad-hoc JSON protocol running over a single data channel. My understanding of the spec is that it expects one data channel per stream along with protobuf framing, so I’m wondering if this might cause interoperability issues with other libp2p implementations. |
@IronJam11 is accurate. This implementation will not interoperate with other libp2p implementations.
|
|
Thank you both @IronJam11 and @asabya for the detailed review — I genuinely appreciate your feedback. You're right on the technical gaps: protobuf framing, per-stream data channels, and proper stream lifecycle signaling (FIN/RESET/STOP_SENDING) are missing from the current implementation. I won't dispute that. These are real spec deviations, and I'm committed to correcting them in subsequent iterations. That said, I'd like to offer some context:-
As the saying goes: everything starts as a mess before it becomes something refined. This PR was always meant to be a foundation — a working proof-of-concept that opens the door, not a final production implementation. Regarding the "bloat" concern: I acknowledge the 29K+ lines, stray debug prints, and 'it was not' unrelated Kademlia commits(but failed CI/CD issue that was fixed thence) I'd welcome guidance on the preferred way to proceed — whether that's a rebase into smaller focused PRs, or a new clean branch with spec-compliant implementation — whatever best serves the project. I'm here to see this through correctly. |
|
Thanks for being open to feedback @Nkovaturient. The research and exploration here is valuable and that groundwork is useful context for us. Being said that I'd recommend a new clean branch rather than a rebase. The core architecture needs to change at a fundamental level — it's not something that can be incrementally patched. The best reference is Happy to collaborate on this. |
Description
Issue #546
Updates
✅ Core Transport Implementation
✅ js-libp2p Compatibility
/libp2p/webrtc/signal/1.0.0message format complianceuEiprefixed base64url certificate hashes✅ Production-Ready Features
Technical Architecture & Design Decisions
Why trio-asyncio Instead of Pure Trio?
Core Challenge: py-libp2p uses Trio for async operations, but aiortc (the robust Python WebRTC library) is built entirely on asyncio. This created a fundamental integration challenge that required careful architectural decisions.
Solution: I have implemented a sophisticated trio-asyncio bridge (
WebRTCAsyncBridge) that provides:Alternative Considered: Writing a pure trio WebRTC implementation would eliminate bridge complexity but would require reimplementing significant portions of WebRTC protocols (DTLS, SCTP, ICE) - a massive undertaking that would delay delivery and introduce bugs.
The trio-asyncio Bridge: Why Essential?
Bridge Benefits:
Current Status
Main Test Suite (
test_webrtc_transport.py)Specialized Test Suites
test_js_libp2p_interop.py: Dedicated js-libp2p compatibility validationtest_live_signaling.py: Live signaling with circuit relay simulationtest_network_optimized.py: Network-independent testing for CI/CD environmentsQuestions
Performance Impact: How does the trio-asyncio bridge affect performance in high-throughput scenarios with 100+ concurrent WebRTC connections? Should we prioritize a pure trio WebRTC implementation for v2?
Stream Multiplexing Integration: How should WebRTC streams integrate with existing yamux/mplex stream multiplexing? Should WebRTC connections be treated as muxed connections themselves, or as transport-level primitives?
Circuit Relay Strategy: What's the preferred integration path for circuit relay reservations with the existing relay discovery mechanism? Should WebRTC transport handle relay discovery independently or leverage existing infrastructure?
NAT Traversal Prioritization: When both STUN servers and direct UDP hole punching are available, what's the preferred fallback hierarchy? How do we balance connection speed vs reliability?
Resource Management Philosophy: Given the trio-asyncio bridge complexity, should we add connection pooling and resource limits to prevent memory leaks in long-running applications?
Next work
IHostfor utilising real network resources for addressing webrtc listeners and get_network [currently on timeout and mocks ]private-to-privatetransport.py. [Must be modular for its extension and utilisation in webrtc-direct transport as well]Cute Animal Picture