Hotwire Streams via streaming HTTP response only replaces when fully received

So I am guessing this is a misunderstanding from my side, but I want to double check.

I am integrating Hotwire into a Kotlin Ktor application. You don’t need to know the specifics of how Kotlin or Ktor works. However so far my experiences with integrating it have been great.

However, I am following Turbo Handbook and I implemented the Accept check in the server code on a Form submit. When detecting the Accept header I will switch to a streaming response where I update the state of the form with <turbo-stream> elements.

I can flush the response buffer when I want, so my idea was to:

  1. set the form button states to loading with a <turbo-stream>, flush()
  2. do some work on the server (simulated with a delay)
  3. render the final form state back again with a <turbo-stream> and flush()

In the Chrome dev console I see the response coming in for the streams. The first turbo-stream comes in, then a nice delay, then the other one.
However, the form only updates with the last entry.

I think I expected that I could stream multiple <turbo-streams> from a typical HTTP response by managing the flushes. But thinking about it it doesn’t make sense. I can imagine Turbo doesn’t know it is a ‘clean’ flush (e.g. functional DOM inside the response) or it is some arbitrary set of chunks that resolves into a functional DOM when the last is in.

I think SSE or WebSockets is the way to go here I suppose or am I missing something?