startStatsReporting method
Future<void>
startStatsReporting(
)
Implementation
Future<void> startStatsReporting() async {
//ToDo(Oliver): leave this here to uncomment to test as needed
//await _initializeLogFile();
if (!debugReportStarted) {
debugStatsId = uuid.v4();
_sendStartDebugReport(debugStatsId);
}
await _sendAddConnectionMessage();
await _setupPeerEventHandlers();
// Start call quality updates every 100ms for real-time UI
GlobalLogger().d(
'Starting call quality updates every ${callQualityIntervalMs}ms',
);
_callQualityTimer = Timer.periodic(
Duration(milliseconds: callQualityIntervalMs),
(_) async {
await _collectCallQualityMetrics();
},
);
// Start socket stats reporting every 3 seconds to avoid overloading
GlobalLogger().d(
'Starting socket stats reporting every ${socketStatsIntervalMs}ms',
);
_socketStatsTimer = Timer.periodic(
Duration(milliseconds: socketStatsIntervalMs),
(_) async {
await _collectAndSendStats();
},
);
}