Async::HTTP::Protocol::HTTP2 (original) (raw)
Definitions
def self.bidirectional?
Signature
returns Boolean
Whether the protocol supports bidirectional communication.
Implementation
def self.bidirectional?
true
enddef self.trailer?
Signature
returns Boolean
Whether the protocol supports trailers.
Implementation
def self.trailer?
true
endCLIENT_SETTINGS = {...}
The default settings for the client.
Implementation
CLIENT_SETTINGS = {
::Protocol::HTTP2::Settings::ENABLE_PUSH => 0,
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1,
}SERVER_SETTINGS = {...}
The default settings for the server.
Implementation
SERVER_SETTINGS = {
# We choose a lower maximum concurrent streams to avoid overloading a single connection/thread.
::Protocol::HTTP2::Settings::MAXIMUM_CONCURRENT_STREAMS => 128,
::Protocol::HTTP2::Settings::MAXIMUM_FRAME_SIZE => 0x100000,
::Protocol::HTTP2::Settings::INITIAL_WINDOW_SIZE => 0x800000,
::Protocol::HTTP2::Settings::ENABLE_CONNECT_PROTOCOL => 1,
::Protocol::HTTP2::Settings::NO_RFC7540_PRIORITIES => 1,
}def self.client(peer, settings: CLIENT_SETTINGS)
Create a client for an outbound connection.
Signature
parameter peer IO
The peer to communicate with.
parameter options Hash
Options to pass to the client instance.
Implementation
def self.client(peer, settings: CLIENT_SETTINGS)
stream = ::IO::Stream(peer)
client = Client.new(stream)
client.send_connection_preface(settings)
client.start_connection
return client
enddef self.server(peer, settings: SERVER_SETTINGS)
Create a server for an inbound connection.
Signature
parameter peer IO
The peer to communicate with.
parameter options Hash
Options to pass to the server instance.
Implementation
def self.server(peer, settings: SERVER_SETTINGS)
stream = ::IO::Stream(peer)
server = Server.new(stream)
server.read_connection_preface(settings)
server.start_connection
return server
enddef self.names
Signature
returns Array
The names of the supported protocol.
Implementation
def self.names
["h2"]
end