yes_web_api.rb �nobvU ���bvU # coding: utf-8 require 'sinatra' require 'sinatra/streaming' set server: 'thin', connections: [] th = Thread.new{ while true puts "currently connection: #{settings.connections.size}" settings.connections.each{ |e| e << "yes\n" } sleep 1 end } get '/' do stream :keep_open do |out| out.callback{ settings.connections.delete(out) } out.errback{ settings.connections.delete