From f44a78a5f5772d3b69a2bc48d960d17ba9555bdb Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sat, 14 Jan 2023 15:20:52 +0600 Subject: [PATCH] small improvement of openBaseWebSocketFlow --- .../dev/inmo/micro_utils/ktor/client/NewFlowsWebsockets.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/NewFlowsWebsockets.kt b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/NewFlowsWebsockets.kt index 95fc92cde3c..95c281f78eb 100644 --- a/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/NewFlowsWebsockets.kt +++ b/ktor/client/src/commonMain/kotlin/dev/inmo/micro_utils/ktor/client/NewFlowsWebsockets.kt @@ -19,7 +19,7 @@ import kotlinx.coroutines.isActive * connection. Must return true in case if must be reconnected. By default always reconnecting */ @Warning("This feature is internal and should not be used directly. It is can be changed without any notification and warranty on compile-time or other guaranties") -inline fun openBaseWebSocketFlow( +inline fun openBaseWebSocketFlow( noinline checkReconnection: suspend (Throwable?) -> Boolean = { true }, noinline webSocketSessionRequest: suspend SendChannel.() -> Unit ): Flow { @@ -57,7 +57,7 @@ inline fun HttpClient.openWebSocketFlow( ): Flow { pluginOrNull(WebSockets) ?: error("Plugin $WebSockets must be installed for using createStandardWebsocketFlow") - return openBaseWebSocketFlow(checkReconnection) { + return openBaseWebSocketFlow(checkReconnection) { val block: suspend DefaultClientWebSocketSession.() -> Unit = { while (isActive) { send(receiveDeserialized())