Created
January 19, 2013 21:27
-
-
Save ryanb/4575312 to your computer and use it in GitHub Desktop.
Revisions
-
ryanb created this gist
Jan 19, 2013 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,12 @@ cd ~/code/rails railties/bin/rails new ~/code/hello --edge cd ~/code/hello echo "gem 'puma'" >> Gemfile bundle rails g controller hello index # fill controller puma # separate tab curl localhost:9292/hello/index # separate tab curl localhost:9292/hello/index # waits until first request finishes This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,13 @@ class HelloController < ApplicationController include ActionController::Live def index response.headers["Content-Type"] = "text/event-stream" 10.times do |n| response.stream.write "data: #{n}...\n\n" sleep 2 end ensure response.stream.close end end