apparently the render :text method with proc is not any longer available in rails 3.2 in order to stream data. I followed the instruction in the folowing
discussion
and tried to stream data with an iterator
class Streamer
attr_reader :url,:uri
def initialize(url)
puts "there"
@url = url
@uri = URI.parse url
end
def each
Net::HTTP.start(uri.host) do |http|
resp = http.get(uri.path) do |str|
puts str
end
end
end
end
this print out the streamed data to the console, but the ultimate goal is streaming to the client so I change it to
resp = http.get(uri.path) do |str|
yield str
end
This code is not working. The request just does not reply with anything. I am running on webrock. So might it be possible that this approach is not working at all with webrick, or is there anything wrong with the code.
Help is appreciated. Regards, Phil