Skip to content

Commit

Permalink
fix: add delay between debugReportStartMessage and the addConnectionM…
Browse files Browse the repository at this point in the history
…essage
  • Loading branch information
gbattistel committed Jan 8, 2025
1 parent 3de5da2 commit e8195dd
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions TelnyxRTC/Telnyx/WebRTC/Stats/WebRTCStatsReporter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,20 @@ class WebRTCStatsReporter {
// MARK: - Initializer
init(socket: Socket) {
self.socket = socket
self.sendDebugReportStartMessage(id: self.reportId)
}

public func startDebugReport(peerId: UUID,
peer: Peer) {

self.peerId = peerId
self.peer = peer
self.sendAddConnectionMessage()
self.sendDebugReportStartMessage(id: self.reportId)

let delay = DispatchTime.now() + 0.2
DispatchQueue.main.asyncAfter(deadline: delay) { [weak self] in
self?.sendAddConnectionMessage()
}
self.setupEventHandler()

let queue = DispatchQueue.main
timer = DispatchSource.makeTimerSource(queue: queue)
timer?.schedule(deadline: .now(), repeating: 2.0)
Expand Down

0 comments on commit e8195dd

Please sign in to comment.