@@ -51,6 +51,30 @@ On a historical note, this specification replaces the existing [libp2p WebRTC st
5151
52529 . Messages on ` RTCDataChannel ` s on the established ` RTCPeerConnection ` are framed using the message framing mechanism described in [ multiplexing] .
5353
54+ ### Diagram
55+
56+ ``` mermaid
57+ sequenceDiagram
58+ participant a as Browser A
59+ participant cr as CircuitRelayV2Peer
60+ participant b as Browser B
61+ participant stun as STUN Server
62+ b->>cr: Establish Relayed Connection (WebTransport, WebRTC)
63+ b-->>a: Shares its own relayed webrtc multiaddress (out of band)
64+ a->>b: Establishes a relayed connection to Browser 2
65+ a-->>a: Creates RTCPeerConnection with STUN server config, init DataChannel and SDP offer
66+ a->>b: Initiates libp2p /webrtc-signaling/0.0.1 protocol stream over relayed conection and sends SDP
67+ b-->>b: Creates RTCPeerConnection with STUN server config, sets Browser1's SDP offer, and creates SDP answer
68+ b->>a: Sends SDP answer over signaling stream
69+ a-->>a: Set SDP answer with RTCPeerConnection.setRemoteDescription
70+ a->>+stun: What's my public IP and port
71+ stun->>-a: Browser A observed ip and port: 8.8.8.1:63333
72+ b->>+stun: What's my public IP and port
73+ stun->>-b: Browser B observed ip and port: 6.6.6.1:52222
74+ b->a: exchange ICE candidates over signalling stream pass to RTCPeerConnection.addIceCandidate()
75+ b->a: Establish direct connection
76+ ```
77+
5478## STUN
5579
5680A node needs to discover its public IP and port, which is forwarded to the remote node in order to connect to the local node.
0 commit comments