diff --git a/buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt b/buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt index 862e13c982..c434958013 100644 --- a/buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt +++ b/buildSrc/src/main/kotlin/io/getstream/video/android/Configuration.kt @@ -6,9 +6,9 @@ object Configuration { const val minSdk = 24 const val majorVersion = 1 const val minorVersion = 0 - const val patchVersion = 8 + const val patchVersion = 9 const val versionName = "$majorVersion.$minorVersion.$patchVersion" - const val versionCode = 32 + const val versionCode = 33 const val snapshotVersionName = "$majorVersion.$minorVersion.${patchVersion + 1}-SNAPSHOT" const val artifactGroup = "io.getstream" const val streamVideoCallGooglePlayVersion = "1.1.4" diff --git a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/PersistentSocket.kt b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/PersistentSocket.kt index e874d9d51e..dbb4b7a9a3 100644 --- a/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/PersistentSocket.kt +++ b/stream-video-android-core/src/main/kotlin/io/getstream/video/android/core/socket/PersistentSocket.kt @@ -37,6 +37,7 @@ import okhttp3.WebSocket import okhttp3.WebSocketListener import org.openapitools.client.models.VideoEvent import stream.video.sfu.event.HealthCheckRequest +import java.io.EOFException import java.io.IOException import java.io.InterruptedIOException import java.net.ConnectException @@ -227,7 +228,7 @@ public open class PersistentSocket( try { connectContinuationCompleted = false connect() - } catch (e: Exception) { + } catch (e: Throwable) { logger.e { "[reconnect] failed to reconnect: $e" } } } @@ -290,15 +291,26 @@ public open class PersistentSocket( } } - internal fun handleError(error: Throwable) { + internal fun handleError(receivedError: Throwable) { // onFailure, onClosed and the 2 onMessage can all generate errors // temporary errors should be logged and retried // permanent errors should be emitted so the app can decide how to handle it if (destroyed) { - logger.d { "[handleError] Ignoring socket error - already closed $error" } + logger.d { "[handleError] Ignoring socket error - already closed $receivedError" } return } - + val error = receivedError.let { + // TODO Alex: This is a bad assumption, but necessary, needs to be checked against the backend + if (it is EOFException) { + ErrorResponse( + 40, + "Unknown error trying to refresh token and reconnect.", + statusCode = 401, + ) + } else { + it + } + } val permanentError = isPermanentError(error) if (permanentError) { logger.e { "[handleError] Permanent error: $error" }