Add more detailed ICE logging

This commit is contained in:
2025-06-01 18:18:42 -07:00
parent 17f82bbeca
commit d0e5372460
2 changed files with 31 additions and 8 deletions

View File

@@ -501,7 +501,7 @@ class PeerConnection {
private ignoreOffer: boolean = false; private ignoreOffer: boolean = false;
private isSettingRemoteAnswerPending: boolean = false; private isSettingRemoteAnswerPending: boolean = false;
private polite = true; private polite = true;
private webRTCSuperlog = false; private webRTCSuperlog = true;
private dataChannelSuperlog = false; private dataChannelSuperlog = false;
private chunkSize = (16 * 1024) - 100; private chunkSize = (16 * 1024) - 100;
messageSuperlog: boolean = false; messageSuperlog: boolean = false;
@@ -521,7 +521,7 @@ class PeerConnection {
iceServers: [ iceServers: [
{ urls: "stun:ddln.app" }, { urls: "stun:ddln.app" },
// { urls: "turn:ddln.app", username: "a", credential: "b" }, // { urls: "turn:ddln.app", username: "a", credential: "b" },
// { urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6 { urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
// { urls: "stun:stun1.l.google.com" }, // { urls: "stun:stun1.l.google.com" },
// { urls: "stun:stun2.l.google.com" }, // { urls: "stun:stun2.l.google.com" },
// { urls: "stun:stun3.l.google.com" }, // { urls: "stun:stun3.l.google.com" },
@@ -651,9 +651,23 @@ class PeerConnection {
// this.rtcPeer.onicecandidate = ({ candidate }) => this.signaler.send(JSON.stringify({ candidate })); // this.rtcPeer.onicecandidate = ({ candidate }) => this.signaler.send(JSON.stringify({ candidate }));
// this.rtcPeer.onicecandidate = ({ candidate }) => console.log.apply(null, log(candidate); // this.rtcPeer.onicecandidate = ({ candidate }) => console.log.apply(null, log(candidate);
this.rtcPeer.onicegatheringstatechange = (event) => {
this.webRTCSuperlog && console.log.apply(null, log("onicegatheringstatechange:", this.rtcPeer?.iceGatheringState));
}
this.rtcPeer.oniceconnectionstatechange = (event:Event) => {
this.webRTCSuperlog && console.log.apply(null, log("oniceconnectionstatechange:", this.rtcPeer?.iceConnectionState));
}
this.rtcPeer.onicecandidateerror = (event: RTCPeerConnectionIceErrorEvent) => {
this.webRTCSuperlog && console.log.apply(null, log(`onicecandidateerror: ${event.errorCode} ${event.errorText} ${event.address} ${event.url}`));
}
this.rtcPeer.onicecandidate = ({ candidate }) => { this.rtcPeer.onicecandidate = ({ candidate }) => {
this.webRTCSuperlog && console.log.apply(null, log(candidate)); this.webRTCSuperlog && console.log.apply(null, log(`onicecandidate`, candidate));
this.sendPeerMessage(this.remotePeerID, { type: "rtc_candidate", candidate: candidate }); this.sendPeerMessage(this.remotePeerID, { type: "rtc_candidate", candidate: candidate });
} }

View File

@@ -373,7 +373,7 @@ class PeerConnection {
this.ignoreOffer = false; this.ignoreOffer = false;
this.isSettingRemoteAnswerPending = false; this.isSettingRemoteAnswerPending = false;
this.polite = true; this.polite = true;
this.webRTCSuperlog = false; this.webRTCSuperlog = true;
this.dataChannelSuperlog = false; this.dataChannelSuperlog = false;
this.chunkSize = (16 * 1024) - 100; this.chunkSize = (16 * 1024) - 100;
this.messageSuperlog = false; this.messageSuperlog = false;
@@ -468,8 +468,17 @@ class PeerConnection {
} }
// this.rtcPeer.onicecandidate = ({ candidate }) => this.signaler.send(JSON.stringify({ candidate })); // this.rtcPeer.onicecandidate = ({ candidate }) => this.signaler.send(JSON.stringify({ candidate }));
// this.rtcPeer.onicecandidate = ({ candidate }) => console.log.apply(null, log(candidate); // this.rtcPeer.onicecandidate = ({ candidate }) => console.log.apply(null, log(candidate);
this.rtcPeer.onicegatheringstatechange = (event) => {
this.webRTCSuperlog && console.log.apply(null, log("onicegatheringstatechange:", this.rtcPeer?.iceGatheringState));
};
this.rtcPeer.oniceconnectionstatechange = (event) => {
this.webRTCSuperlog && console.log.apply(null, log("oniceconnectionstatechange:", this.rtcPeer?.iceConnectionState));
};
this.rtcPeer.onicecandidateerror = (event) => {
this.webRTCSuperlog && console.log.apply(null, log(`onicecandidateerror: ${event.errorCode} ${event.errorText} ${event.address} ${event.url}`));
};
this.rtcPeer.onicecandidate = ({ candidate }) => { this.rtcPeer.onicecandidate = ({ candidate }) => {
this.webRTCSuperlog && console.log.apply(null, log(candidate)); this.webRTCSuperlog && console.log.apply(null, log(`onicecandidate`, candidate));
this.sendPeerMessage(this.remotePeerID, { type: "rtc_candidate", candidate: candidate }); this.sendPeerMessage(this.remotePeerID, { type: "rtc_candidate", candidate: candidate });
}; };
this.rtcPeer.onnegotiationneeded = async (event) => { this.rtcPeer.onnegotiationneeded = async (event) => {
@@ -683,7 +692,7 @@ PeerConnection.config = {
iceServers: [ iceServers: [
{ urls: "stun:ddln.app" }, { urls: "stun:ddln.app" },
// { urls: "turn:ddln.app", username: "a", credential: "b" }, // { urls: "turn:ddln.app", username: "a", credential: "b" },
// { urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6 { urls: "stun:stun.l.google.com" }, // keeping this for now as my STUN server is not returning ipv6
// { urls: "stun:stun1.l.google.com" }, // { urls: "stun:stun1.l.google.com" },
// { urls: "stun:stun2.l.google.com" }, // { urls: "stun:stun2.l.google.com" },
// { urls: "stun:stun3.l.google.com" }, // { urls: "stun:stun3.l.google.com" },