Forcing Volt views to flush output before they are finished

I'm pursuing all ways to optimize my web app and I'm considering inlining the first already known JS API call data into the body of the HTML. One of the slower queries might take 50-100(?)ms and in this case I would like to flush the HTML up to a certain point so that the browser can begin downloading the javascript while the server is crunching the slower query. The idea is minimize on the worst case first query time and to prevent another potentially slow overseas latency (or even Great Firewall, etc) unnecessary slowdown.

Is there a nice way to do this as all of the function extensions seem to want to return a string? Also would flushing the view intefere with Phalcon? Is the PHP output going straight out or is it already buffering in some way?



46.8k

Oh. I was getting a weird error message on post so I assumed that it didn't go through.

Hmm, I think that I just specifically want to do a ob_flush, flush kind of thing just in that one single instance. I don't want to tweak the entire app.