(X-Post from <#C0B8RC352|server>) Hey :wave: I'm d...
# ktor
j
(X-Post from #server) Hey 👋 I'm developing a backend with Ktor, loving the framework so far! In some cases, I'll have to handle several (possibly large) responses from another backend, process them and forward them to my client. For now this is all rest, no web sockets. Is there anyway in Ktor to have a constant flow of responses to the client? Something like Spring WebFlux, I'd like to have a reactive flux of responses in Ktor. Have you ever implemented such thing with Ktor? Is it even possible as the framework stands today? Did you have success with any other framework? Thanks in advance 🙏
c
you can use coroutines in accessing the the other backend, and put the responses into a flow. and in ktor you just keep writing to the response.
d
Be warned; in case you're thinking of using WebSockets later, I found them to be completely broken when Ktor is deployed in a WAR Container and not using the Embedded engine. This is dangerous because it's likely Devs will start using Embedded then try to deploy in a Container later, only to then find it doesn't work 😱 ... https://youtrack.jetbrains.com/issue/KTOR-184
j
@christophsturm thank you! I was trying that out and was not being able to see the responses as they were being emitted by the flow. turns out, it was the client's fault, because when I tried it with another client, curl, I could see the responses arriving one by one as expected.
@darkmoon_uk thank you for the heads up, wasn't aware of that!
d
@João Rodrigues You may want to vote for: https://youtrack.jetbrains.com/issue/KTOR-184
1