Skip to content

Instantly share code, notes, and snippets.

@andriytyurnikov
Forked from josevalim/config.ru
Last active December 14, 2015 10:49
Show Gist options
  • Save andriytyurnikov/5074502 to your computer and use it in GitHub Desktop.
Save andriytyurnikov/5074502 to your computer and use it in GitHub Desktop.
# rackup -s puma
require 'puma' # thin does some weird caching
run proc { |env|
body = Enumerator.new do |socket|
socket << " "*1024 # Browsers wait for time or big data chunk
5.times do
socket << "Hello"
puts "Hello"
sleep 1
end
end
# if Content-Type is text/html, html parser may delay rendering of text
[200, { "Content-Encoding" => "chunked" }, body]
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment