同样的代码,跑在 thin 上面死活报“ << not opend for writing" 偶尔试了下 puma,能够正确执行
大概代码:
require 'sinatra/base' require 'sinatra/streaming'
class Test < Sinatra::Base helpers Sinatra::Streaming
get '/' do stream :keep_open do |out| out << 'request stream" 11.tiems { |i| out << Time.now| end end end