WebRTC-Experiment
WebRTC-Experiment copied to clipboard
How can peer.js reconnect to the same peer after disconnection?
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;
}
};