How can WebRTC reconnect to the same peer after disconnection?

Jeremy Li picture Jeremy Li · Aug 17, 2015 · Viewed 8.5k times · Source

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 ?

Answer

Jeremy Li picture Jeremy Li · Aug 21, 2015

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 !!!