From d095672f00b1fbc3f54512e5de6a9a810ec1c6bb Mon Sep 17 00:00:00 2001 From: Avently <7953703+avently@users.noreply.github.com> Date: Mon, 3 Jun 2024 17:44:04 +0700 Subject: [PATCH] more private logs --- .../src/commonMain/resources/assets/www/call.js | 17 +++++++---------- packages/simplex-chat-webrtc/src/call.ts | 17 +++++++---------- 2 files changed, 14 insertions(+), 20 deletions(-) diff --git a/apps/multiplatform/common/src/commonMain/resources/assets/www/call.js b/apps/multiplatform/common/src/commonMain/resources/assets/www/call.js index 3020566163..aa0489d5c0 100644 --- a/apps/multiplatform/common/src/commonMain/resources/assets/www/call.js +++ b/apps/multiplatform/common/src/commonMain/resources/assets/www/call.js @@ -93,8 +93,7 @@ const processCommand = (function () { if (delay) clearTimeout(delay); resolved = true; - // console.log("resolveIceCandidates", JSON.stringify(candidates)) - console.log("resolveIceCandidates"); + console.log("resolveIceCandidates", JSON.stringify(candidates)); const iceCandidates = serialize(candidates); candidates = []; resolve(iceCandidates); @@ -102,8 +101,7 @@ const processCommand = (function () { function sendIceCandidates() { if (candidates.length === 0) return; - // console.log("sendIceCandidates", JSON.stringify(candidates)) - console.log("sendIceCandidates"); + console.log("sendIceCandidates", JSON.stringify(candidates)); const iceCandidates = serialize(candidates); candidates = []; sendMessageToNative({ resp: { type: "ice", iceCandidates } }); @@ -255,7 +253,7 @@ const processCommand = (function () { iceCandidates: await activeCall.iceCandidates, capabilities: { encryption }, }; - // console.log("offer response", JSON.stringify(resp)) + console.log("offer response", JSON.stringify(resp)); break; } case "offer": @@ -271,7 +269,7 @@ const processCommand = (function () { const { media, aesKey, iceServers, relay } = command; activeCall = await initializeCall(getCallConfig(!!aesKey, iceServers, relay), media, aesKey); const pc = activeCall.connection; - // console.log("offer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) + console.log("offer remoteIceCandidates", JSON.stringify(remoteIceCandidates)); await pc.setRemoteDescription(new RTCSessionDescription(offer)); const answer = await pc.createAnswer(); await pc.setLocalDescription(answer); @@ -283,7 +281,7 @@ const processCommand = (function () { iceCandidates: await activeCall.iceCandidates, }; } - // console.log("answer response", JSON.stringify(resp)) + console.log("answer response", JSON.stringify(resp)); break; case "answer": if (!pc) { @@ -298,7 +296,7 @@ const processCommand = (function () { else { const answer = parse(command.answer); const remoteIceCandidates = parse(command.iceCandidates); - // console.log("answer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) + console.log("answer remoteIceCandidates", JSON.stringify(remoteIceCandidates)); await pc.setRemoteDescription(new RTCSessionDescription(answer)); addIceCandidates(pc, remoteIceCandidates); resp = { type: "ok" }; @@ -374,9 +372,8 @@ const processCommand = (function () { } function addIceCandidates(conn, iceCandidates) { for (const c of iceCandidates) { - console.log("Adding ice candidate"); conn.addIceCandidate(new RTCIceCandidate(c)); - // console.log("addIceCandidates", JSON.stringify(c)) + console.log("addIceCandidates", JSON.stringify(c)); } } async function setupMediaStreams(call) { diff --git a/packages/simplex-chat-webrtc/src/call.ts b/packages/simplex-chat-webrtc/src/call.ts index 0562dfb6a9..c0b0b3d4e7 100644 --- a/packages/simplex-chat-webrtc/src/call.ts +++ b/packages/simplex-chat-webrtc/src/call.ts @@ -302,8 +302,7 @@ const processCommand = (function () { function resolveIceCandidates() { if (delay) clearTimeout(delay) resolved = true - // console.log("resolveIceCandidates", JSON.stringify(candidates)) - console.log("resolveIceCandidates") + console.log("resolveIceCandidates", JSON.stringify(candidates)) const iceCandidates = serialize(candidates) candidates = [] resolve(iceCandidates) @@ -311,8 +310,7 @@ const processCommand = (function () { function sendIceCandidates() { if (candidates.length === 0) return - // console.log("sendIceCandidates", JSON.stringify(candidates)) - console.log("sendIceCandidates") + console.log("sendIceCandidates", JSON.stringify(candidates)) const iceCandidates = serialize(candidates) candidates = [] sendMessageToNative({resp: {type: "ice", iceCandidates}}) @@ -466,7 +464,7 @@ const processCommand = (function () { iceCandidates: await activeCall.iceCandidates, capabilities: {encryption}, } - // console.log("offer response", JSON.stringify(resp)) + console.log("offer response", JSON.stringify(resp)) break } case "offer": @@ -480,7 +478,7 @@ const processCommand = (function () { const {media, aesKey, iceServers, relay} = command activeCall = await initializeCall(getCallConfig(!!aesKey, iceServers, relay), media, aesKey) const pc = activeCall.connection - // console.log("offer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) + console.log("offer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) await pc.setRemoteDescription(new RTCSessionDescription(offer)) const answer = await pc.createAnswer() await pc.setLocalDescription(answer) @@ -492,7 +490,7 @@ const processCommand = (function () { iceCandidates: await activeCall.iceCandidates, } } - // console.log("answer response", JSON.stringify(resp)) + console.log("answer response", JSON.stringify(resp)) break case "answer": if (!pc) { @@ -504,7 +502,7 @@ const processCommand = (function () { } else { const answer: RTCSessionDescriptionInit = parse(command.answer) const remoteIceCandidates: RTCIceCandidateInit[] = parse(command.iceCandidates) - // console.log("answer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) + console.log("answer remoteIceCandidates", JSON.stringify(remoteIceCandidates)) await pc.setRemoteDescription(new RTCSessionDescription(answer)) addIceCandidates(pc, remoteIceCandidates) resp = {type: "ok"} @@ -575,9 +573,8 @@ const processCommand = (function () { function addIceCandidates(conn: RTCPeerConnection, iceCandidates: RTCIceCandidateInit[]) { for (const c of iceCandidates) { - console.log("Adding ice candidate") conn.addIceCandidate(new RTCIceCandidate(c)) - // console.log("addIceCandidates", JSON.stringify(c)) + console.log("addIceCandidates", JSON.stringify(c)) } }