From d3387ef87eeae165e904612d6e81890011b5b48e Mon Sep 17 00:00:00 2001 From: Robert Jaros Date: Mon, 14 Oct 2019 00:09:48 +0200 Subject: Remove deprecated API call --- .../main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt index 482c2526..2c74e611 100644 --- a/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt +++ b/kvision-modules/kvision-server-spring-boot/src/main/kotlin/pl/treksoft/kvision/remote/KVWebSocketConfig.kt @@ -24,13 +24,14 @@ package pl.treksoft.kvision.remote import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.ExperimentalCoroutinesApi -import kotlinx.coroutines.ObsoleteCoroutinesApi +import kotlinx.coroutines.FlowPreview import kotlinx.coroutines.async import kotlinx.coroutines.channels.Channel import kotlinx.coroutines.channels.ReceiveChannel import kotlinx.coroutines.channels.SendChannel import kotlinx.coroutines.coroutineScope import kotlinx.coroutines.flow.collect +import kotlinx.coroutines.flow.consumeAsFlow import kotlinx.coroutines.launch import kotlinx.coroutines.reactive.asFlow import kotlinx.coroutines.reactor.asFlux @@ -62,12 +63,12 @@ class KVWebSocketHandler( }.first() } - @UseExperimental(ObsoleteCoroutinesApi::class, ExperimentalCoroutinesApi::class) + @UseExperimental(ExperimentalCoroutinesApi::class, FlowPreview::class) override fun handle(session: WebSocketSession): Mono { val handler = getHandler(session) val responseChannel = Channel() val requestChannel = Channel() - val output = session.send(responseChannel.asFlux(EmptyCoroutineContext).map(session::textMessage)) + val output = session.send(responseChannel.consumeAsFlow().asFlux().map(session::textMessage)) val input = async { coroutineScope { launch { -- cgit