The best answer I can give you is one I answered a few days ago on the Nitrogen mailing list:
There isn't a great way to deal with this. There are two ways to deal with this:
1) Using the underlying server's streaming mechanisms (such as making a cowboy-specific dispatch table to targets a cowboy handler module that deals with the streaming), or a yaws outfile.
2) Using cowboy, there's a bit of a hack that can work in
simple_bridge if you're using cowboy. If your module's main()
function
returns the tuple: {stream, StreamFun}
where StreamFun is a function
with arity 2 that (fun(Socket, Transport)
- Transport being a ranch
transport). Really, this is just a shortcut way that allows you to
use Transport:send(socket) to send data. I'll admit I haven't done
this before, but it should work with a little bit of tinkering.
Adding this as an actual option to simple_bridge and Nitrogen would probably be worthwhile.