mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-11-25 19:48:45 +00:00
link fix in ktor server
This commit is contained in:
parent
273a7aa9a4
commit
740036e8d9
@ -2,8 +2,7 @@ package dev.inmo.micro_utils.ktor.server
|
||||
|
||||
import dev.inmo.micro_utils.coroutines.safely
|
||||
import dev.inmo.micro_utils.ktor.common.*
|
||||
import io.ktor.http.cio.websocket.DefaultWebSocketSession
|
||||
import io.ktor.http.cio.websocket.close
|
||||
import io.ktor.http.cio.websocket.*
|
||||
import io.ktor.routing.Route
|
||||
import io.ktor.websocket.webSocket
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
@ -23,13 +22,11 @@ fun <T> Route.includeWebsocketHandling(
|
||||
converter: (T) -> StandardKtorSerialInputData
|
||||
) {
|
||||
webSocket(suburl) {
|
||||
// println("connected")
|
||||
safely {
|
||||
flow.collect {
|
||||
send(converter(it))
|
||||
}
|
||||
}
|
||||
// println("disconnected")
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user