I'd like try async-http got stuck when running the example from the README:
Example
require 'async/http/server'
require 'async/http/client'
require 'async/reactor'
server_addresses = [
Async::IO::Endpoint.tcp('127.0.0.1', 9294, reuse_port: true)
]
app = lambda do |env|
[200, {}, ["Hello World"]]
end
server = Async::HTTP::Server.new(server_addresses, app)
client = Async::HTTP::Client.new(server_addresses)
Async::Reactor.run do |task|
server_task = task.async do
server.run
end
response = client.get("/", {})
puts response.body
server_task.stop
end
Error
$ ruby example.rb
/home/peter/.rvm/gems/ruby-2.4.1@pg/gems/async-http-0.3.1/lib/async/http/server.rb:40:in `accept': undefined method `new' for #<Proc:0x00000001e97b58@example.rb:9 (lambda)> (NoMethodError)
from /home/peter/.rvm/gems/ruby-2.4.1@pg/gems/async-io-1.0.0/lib/async/io/socket.rb:63:in `block in accept_each'
from /home/peter/.rvm/gems/ruby-2.4.1@pg/gems/async-1.1.0/lib/async/task.rb:74:in `block in initialize'
Hi,
I'd like try
async-http
got stuck when running the example from the README:Example
Error
Do you have any hints what I did wrong?
Kind regards, Peter