transfer encoding chunked ruby code example
Example: transfer encoding chunked ruby
require 'net/http'
streamURL = 'http://localhost/sample-stream.php'
uri = URI.parse(streamURL)
Net::HTTP.start(uri.host, uri.port) do |http|
request = Net::HTTP::Get.new uri.request_uri
http.request request do |response|
response.read_body do |chunk|
#We get the data here chunk-by-chunk
puts chunk
end
end
end