class Listener
Describes a bound listener for a Falcon server.
Definitions
def initialize(name:, scheme:, protocols:, endpoint:)
Initialize a bound listener.
Signature
-
parameter
nameString The logical listener name.
-
parameter
schemeString The application protocol scheme.
-
parameter
protocolsArray(String) The supported application protocol names.
-
parameter
endpointIO::Endpoint::BoundEndpoint The bound endpoint.
Implementation
def initialize(name:, scheme:, protocols:, endpoint:)
@name = name
@scheme = scheme
@protocols = protocols.map(&:to_s).freeze
@endpoint = endpoint
@addresses = endpoint.sockets.map{|socket| socket.to_io.local_address}.freeze
freeze
end
attr_reader :name
Signature
-
attribute
String The logical listener name.
attr_reader :scheme
Signature
-
attribute
String The application protocol scheme.
attr_reader :protocols
Signature
-
attribute
Array(String) The supported application protocol names.
attr_reader :endpoint
Signature
-
attribute
IO::Endpoint::BoundEndpoint The bound endpoint.
attr_reader :addresses
Signature
-
attribute
Array(Addrinfo) The bound addresses.
def close
Close the bound endpoint.
Implementation
def close
@endpoint.close
end