Class: HTTP2::Server

Inherits:
Connection show all
Defined in:
lib/http/2/server.rb

Overview

HTTP 2.0 server connection class that implements appropriate header compression / decompression algorithms and stream management logic.

Your code is responsible for feeding request data to the server object, which in turn performs all of the necessary HTTP 2.0 decoding / encoding, state management, and the rest. A simple example:

Examples:

socket = YourTransport.new

conn = HTTP2::Server.new
conn.on(:stream) do |stream|
  ...
end

while bytes = socket.read
  conn << bytes
end

Instance Attribute Summary

Attributes inherited from Connection

#active_stream_count, #error, #local_settings, #local_window, #pending_settings, #remote_settings, #remote_window, #state

Instance Method Summary collapse

Methods inherited from Connection

#goaway, #new_stream, #ping, #receive, #settings

Methods included from Emitter

#add_listener, #emit, #once

Methods included from FlowBuffer

#buffered_amount

Constructor Details

#initialize(**settings) ⇒ Server

Initialize new HTTP 2.0 server object.



25
26
27
28
29
30
31
32
33
# File 'lib/http/2/server.rb', line 25

def initialize(**settings)
  @stream_id    = 2
  @state        = :waiting_magic

  @local_role   = :server
  @remote_role  = :client

  super
end