Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can WebRTC reconnect to the same peer after disconnection?

Tags:

html

chat

webrtc

Now I am working on a peer-to-peer chatting system based on WebRTC. This system can make a pair with any person who is listening on the peer list at the same time and I have finished the basic functionanity of real-time communication in audio and video. But I have no ideas how to reconnect to the same peer if it disconnected accidentally ?

like image 409
Jeremy Li Avatar asked Aug 17 '15 10:08

Jeremy Li


People also ask

How does WebRTC peer-to-peer work?

WebRTC in the real world Users discover each other and exchange details such as names. WebRTC client applications (peers) exchange network information. Peers exchange data about media such as video format and resolution. WebRTC client applications traverse NAT gateways and firewalls.

How is a WebRTC connection established?

WebRTC allows real-time, peer-to-peer, media exchange between two devices. A connection is established through a discovery and negotiation process called signaling.

How do I close RTC peer connection?

close() The RTCPeerConnection. close() method closes the current peer connection.

What is renegotiation WebRTC?

Renegotiation is a process allows you modify pre-created peer connections when you want to: append additional streams. remove existing streams. modify SDP for peers direction or something else.


1 Answers

Thanks ! As mido22 mention that iceConnectionState automatically changes to connected if disconnected by some connection problem. I found some articles on here https://developer.mozilla.org/en-US/docs/Web/API/RTCPeerConnection/iceConnectionState , and it solved my confusion about the recovery operation of automatic-reconnecting to the same peer on some flaky network !!!

like image 104
Jeremy Li Avatar answered Sep 21 '22 19:09

Jeremy Li