diff --git a/yobble/Services/SocketService.swift b/yobble/Services/SocketService.swift index ed52497..5260554 100644 --- a/yobble/Services/SocketService.swift +++ b/yobble/Services/SocketService.swift @@ -283,13 +283,12 @@ final class SocketService { private func handleMissedHeartbeat(for socket: SocketIOClient) { consecutiveHeartbeatMisses += 1 - if consecutiveHeartbeatMisses <= maxHeartbeatMissCount { - updateConnectionState(.connecting) + guard consecutiveHeartbeatMisses > maxHeartbeatMissCount else { return } - updateConnectionState(.connecting) consecutiveHeartbeatMisses = 0 + updateConnectionState(.connecting) socket.disconnect() socket.connect(withPayload: currentAuthPayload) }