From d922329437fce1e5c6e5c17d1a682ecba0e631e1 Mon Sep 17 00:00:00 2001 From: Bas van den Aakster Date: Sat, 15 Nov 2025 12:39:45 +0100 Subject: [PATCH] Add API-level ICE candidate exchange logging MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Added logging to track when ICE candidates are sent to and received from the signaling server to help diagnose connection exchange issues. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- src/App.jsx | 26 ++++++++++++++++++++++++-- 1 file changed, 24 insertions(+), 2 deletions(-) diff --git a/src/App.jsx b/src/App.jsx index 2b446ad..14d2f78 100644 --- a/src/App.jsx +++ b/src/App.jsx @@ -104,7 +104,8 @@ export default function App() { // Create connection using the manager const conn = client.createConnection(RTC_CONFIG); - // Add ICE debugging + // Add debugging + addApiLogging(client); addIceLogging(conn); // Setup event listeners @@ -191,7 +192,8 @@ export default function App() { // Create connection using the manager const conn = client.createConnection(RTC_CONFIG); - // Add ICE debugging + // Add debugging + addApiLogging(client); addIceLogging(conn); // Setup event listeners @@ -254,6 +256,26 @@ export default function App() { )); }; + // Add API-level ICE candidate logging + const addApiLogging = (client) => { + const originalAddIceCandidates = client.offers.addIceCandidates.bind(client.offers); + const originalGetIceCandidates = client.offers.getIceCandidates.bind(client.offers); + + client.offers.addIceCandidates = async (offerId, candidates) => { + console.log(`📤 Sending ${candidates.length} ICE candidate(s) to server for offer ${offerId}`); + return originalAddIceCandidates(offerId, candidates); + }; + + client.offers.getIceCandidates = async (offerId, since) => { + const result = await originalGetIceCandidates(offerId, since); + console.log(`📥 Received ${result.length} ICE candidate(s) from server for offer ${offerId}, since=${since}`); + if (result.length > 0) { + console.log(`📥 First candidate:`, result[0]); + } + return result; + }; + }; + // Add ICE debugging to a connection (without overwriting existing handlers) const addIceLogging = (conn) => { const pc = conn['pc']; // Access underlying peer connection for debugging