Sha256: 398f02a399eefb1847c7dab2338a1151df65944841fcccd10ff2e66a367dd07c

Contents?: true

Size: 559 Bytes

Versions: 18

Compression:

Stored size: 559 Bytes

Contents

#!/usr/bin/env ruby

require 'async'
require 'async/http/internet'

Async do |parent|
	internet = Async::HTTP::Internet.new
	connection = nil
	
	child = parent.async do
		response = internet.get("https://utopia-falcon-heroku.herokuapp.com/beer/index")
		connection = response.connection
		
		response.each do |chunk|
			Async.logger.info(response) {chunk}
		end
	ensure
		Async.logger.info(response) {"Closing response..."}
		response&.close
	end
	
	parent.sleep(5)
	
	Async.logger.info(parent) {"Killing #{child}..."}
	child.stop
ensure
	internet&.close
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
async-http-0.52.4 examples/stream/stop.rb
async-http-0.52.3 examples/stream/stop.rb
async-http-0.52.2 examples/stream/stop.rb
async-http-0.52.1 examples/stream/stop.rb
async-http-0.52.0 examples/stream/stop.rb
async-http-0.51.6 examples/stream/stop.rb
async-http-0.51.5 examples/stream/stop.rb
async-http-0.51.4 examples/stream/stop.rb
async-http-0.51.3 examples/stream/stop.rb
async-http-0.51.2 examples/stream/stop.rb
async-http-0.51.1 examples/stream/stop.rb
async-http-0.51.0 examples/stream/stop.rb
async-http-0.50.13 examples/stream/stop.rb
async-http-0.50.12 examples/stream/stop.rb
async-http-0.50.11 examples/stream/stop.rb
async-http-0.50.10 examples/stream/stop.rb
async-http-0.50.9 examples/stream/stop.rb
async-http-0.50.8 examples/stream/stop.rb