Hi. What is a good way to answer http get query wi...
# ktor
p
Hi. What is a good way to answer http get query with stream of events. I mean, no content length, infinity long living query, which sometime print a line to output, if client is still there. call.respondOutputStream with explicit flushes seams to be working, but doesn't look suspend friendly. Won't it block more threads than needed?
a
You can try using the
call.respondBytesWriter {}
that uses a
ByteWriteChannel
under the hood.
p
But it still looks like blocking API, as lambda itself wouldn't be suspend.
a
The lambda is suspendable. What do you mean that it wouldn’t be suspend?
p
Hm. I need to recheck API. But anyway, writer.flush() is not suspend.