Skip to content

Commit

Permalink
webrtc: specify init channel for connection establishment (#578)
Browse files Browse the repository at this point in the history
  • Loading branch information
sukunrt authored Sep 27, 2023
1 parent cac0725 commit 0154bdf
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion webrtc/webrtc.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ On a historical note, this specification replaces the existing [libp2p WebRTC st
Note that further steps depend on the relayed connection to be authenticated, i.e. that data sent on the relayed connection can be trusted.

4. _A_ (outbound side of relayed connection) creates an `RTCPeerConnection` provided by a W3C compliant WebRTC implementation (e.g. a browser).
_A_ creates a datachannel via `RTCPeerConnection.createDataChannel` with the label `init`. This channel is required to ensure that ICE information is shared in the SDP offer.
See [STUN](#stun) section on what STUN servers to configure at creation time.
_A_ creates an SDP offer via `RTCPeerConnection.createOffer()`.
_A_ initiates the signaling protocol to _B_ via the relayed connection from (1), see [Signaling Protocol](#signaling-protocol) and sends the offer to _B_.
Expand All @@ -43,7 +44,7 @@ On a historical note, this specification replaces the existing [libp2p WebRTC st
7. _A_ and _B_ send their local ICE candidates via the existing signaling protocol stream to enable trickle ICE.
Both nodes continuously read from the stream, adding incoming remote candidates via `RTCPeerConnection.addIceCandidate()`.

8. On successful establishment of the direct connection, _B_ and _A_ close the signaling protocol stream.
8. On successful establishment of the direct connection, _A_ closes the `init` data channel created in step _4_, _B_ and _A_ close the signaling protocol stream.
On failure _B_ and _A_ reset the signaling protocol stream.

Behavior for transferring data on a relayed connection, in the case where the direct connection failed, is out of scope for this specification and dependent on the application.
Expand Down

0 comments on commit 0154bdf

Please sign in to comment.