From this issue: <https://youtrack.jetbrains.com/i...
# ktor
m
From this issue: https://youtrack.jetbrains.com/issue/KTOR-2187/How-to-detect-if-a-request-was-cancelled-from-client-on-Ktor-server this api used to exists, the
configure = ...
in this case to detect when the client dropped the channel, it no longer exists in ktor 3. Is there an equivalent? was it moved?
Copy code
embeddedServer(Netty, port = 8080, host = "0.0.0.0", configure = {
        channelPipelineConfig = {
            addLast("cancellationDetector", AbortableRequestHandler())
        }
    }) {
        configureRouting()
    }.start(wait = true)
it was an overload issue, it still exists just with different parameters
👌 1
after toying a bit with this, it's clear that the implementation in that ktor issue is broken since the handler is reused between requests, is there a proper way to detect the client dropping the connection?
right now I am relaying on (psude code)
Copy code
call.respondText {
   GlobalScope.launch { sendPingOrCloseScope() }
   someFlow.collect { sendStuff() }
}
It's not very elegant to depend on a
ChannelClosedException
from the ping when the flow is busy, but there seems no way to actually check for call "liveness"
👀 1