the code example for streaming responses seems to ...
# ktor
c
the code example for streaming responses seems to be outdated, it does not compile: https://ktor.io/docs/response.html#streaming
readRemaining has 2 parameters
s
Check your imports, there are extension functions that take different numbers of params
You may just need to add
import io.ktor.utils.io.readRemaining
🙏 1
c
strange that idea does not offer to add that import
btw is there an easy way to stream the response line buffered? (split at \n)
s
There's a
readUTF8Line
function, but for other encodings you might have to roll your own
c
oh cool thats exactly what I need. thanks!
does streaming work well with all clients or what client would you recommend?
s
I'm mainly using the Apache client, and I've had mixed success with response streaming. Some odd truncated chunk errors that may or may not be Ktor's fault. Don't know much about the other clients. I've been tempted to try CIO because I assume it's been designed specifically to work with Ktor's streaming model.
As far as I can tell, the "non streaming" methods in ktor client are really implemented on top of the streaming APIs anyway
🙏 1