module Sinatra::Helpers

def stream(keep_open = false, &block)

servers like Thin or Rainbows.
after the block has been executed. This is only relevant for evented
The close parameter specifies whether Stream#close should be called

the response body have not yet been generated.
Allows to start sending data to the client even though later parts of
def stream(keep_open = false, &block)
  scheduler = env['async.callback'] ? EventMachine : Stream
  body Stream.new(scheduler, keep_open, &block)
end