Hello, is there a documentation on ktor or a sampl...
# ktor
v
Hello, is there a documentation on ktor or a sample to proxy in image, receive this image and send it to the client directly please ?
1
d
If you are looking for a reverse proxy. Take a look at this: https://github.com/ktorio/ktor-exercises
v
Thanks, I will look !
👍 1
In this example, the program wait to have the entire file before send it… Is it possible to do this as and when. When we receive a bit we send it etc until the file is finish ?
d
Yes it is possible you have to pipe streams. I thought it was doing that already but it seems that i didn’t remember it well
Im in holidays and i do not have a computer right now so i cannot update the sample or tell you exactly how
v
Ok I understand, if you find an example after your holidays it can be very useful for me ! Have good holidays 🙂
o
May be @cy can help?
🙂 1
e
Maybe this could help:
Copy code
val body = client.get<ByteReadChannel>(...)
call.respond(
  HttpStatusCode.OK, 
  object: OutgoingContent.ReadChannelContent() {
      override fun readFrom(): ByteReadChannel = body
})
v
I will try thank for your help
e
No problem 🙂
v
That works, thank. But how to be sure that send byte by byte and not everything in one request ?
e
ByteChannel
size is limited. There is no way to keep more than 4k bytes there.
So you could write a test with size >4kb
v
Ok perfect, thank you very much for your help !
🙂 1