Created
April 13, 2012 04:09
-
-
Save dongyuwei/2373598 to your computer and use it in GitHub Desktop.
sinatra stream
This file contains 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 characters
require 'rubygems' | |
require 'sinatra' | |
require 'eventmachine' | |
get '/evented' do | |
stream(:keep_open) do |out| | |
EventMachine::PeriodicTimer.new(1) { out << "#{Time.now}\n" } | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
visit http://127.0.0.1:4567/evented