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, #state, #stream_limit, #window

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

- (Server) initialize(*args)

Initialize new HTTP 2.0 server object.



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

def initialize(*args)
  @stream_id    = 2
  @state        = :new
  @compressor   = Header::Compressor.new(:response)
  @decompressor = Header::Decompressor.new(:request)

  super
end