WebRTC-Experiment icon indicating copy to clipboard operation
WebRTC-Experiment copied to clipboard

How can peer.js reconnect to the same peer after disconnection?

Open veezo2007pk opened this issue 4 years ago • 0 comments

i need to know if 2 peers are connected on call when we get message - ice connection state is disconnected, it close all windows and dicsonnect 2 peer. Can we handle to reconnect when ice server disconnect?

here is code for iceconnectionstatechange

pc.oniceconnectionstatechange = function() {
        switch (pc.iceConnectionState) {
          case "failed":
            util.log(
                "iceConnectionState is disconnected, closing connections to " + peerId
            );
            connection.emit(
                "error",
                new Error("Negotiation of connection to " + peerId + " failed.")
                );
                connection.close();
            break;
          case "disconnected":
            util.log(
                "iceConnectionState is disconnected, closing connections to " + peerId
                );
              
            connection.close();
            break;
          case "completed":
            pc.onicecandidate = util.noop;
            break;
        }
      };

veezo2007pk avatar Apr 15 '20 05:04 veezo2007pk