Class: A2A::Server::FalconRunner

Inherits:
Object
  • Object
show all
Defined in:
lib/simple_a2a/server/falcon_runner.rb

Constant Summary collapse

DEFAULT_HOST =
"localhost"
DEFAULT_PORT =
9292

Instance Method Summary collapse

Constructor Details

#initialize(app, host: DEFAULT_HOST, port: DEFAULT_PORT) ⇒ FalconRunner

Returns a new instance of FalconRunner.



13
14
15
16
17
# File 'lib/simple_a2a/server/falcon_runner.rb', line 13

def initialize(app, host: DEFAULT_HOST, port: DEFAULT_PORT)
  @app  = app
  @host = host
  @port = port
end

Instance Method Details

#runObject



19
20
21
22
23
24
25
26
27
28
# File 'lib/simple_a2a/server/falcon_runner.rb', line 19

def run
  endpoint = Async::HTTP::Endpoint.parse("http://#{@host}:#{@port}")
  server   = Falcon::Server.new(Falcon::Server.middleware(@app), endpoint)

  Async do
    server.run
  end
rescue Interrupt
  # Ctrl-C — clean shutdown, no backtrace needed
end