Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WebRTC - Reusing connections

Tags:

webrtc

Say we have the following:

  1. Peer1 joins, creates RTCPeerConnectionA
  2. Peer2 joins, creates RTCPeerConnectionB
  3. SDP/ICE handshakes occur, connection is established, streaming is happening

    4A. Peer2 loses connectivity and rejoins

    4B. Peer2 refreshes the browser

What should Peer1 do in 4A and 4B?

With 4A the same RTCPeerConnection object is available for the peer to use - is there any work that needs to be done to completely repair the connection?

In 4B, Peer1 has maintained one end of the connection but Peer2 is starting out from scratch. Can Peer1 re-use the ICE candidates and localDescription to repair the connection with the new RTCPeerConnection on the other end, or does it also need to create a brand new instance of RTCPeerConnection and reinitiate handshakes, onicecandidate, etc?

like image 692
SB2055 Avatar asked Oct 26 '25 23:10

SB2055


1 Answers

4a: this is done with an ice restart. https://webrtc.github.io/samples/src/content/peerconnection/restart-ice/ is an example of how to do this.

4b: a new peerconnection will be needed as the refreshed tab will not have the crypto credentials to decode the old stream.

like image 185
Philipp Hancke Avatar answered Oct 29 '25 13:10

Philipp Hancke