class HTTP2Adapter

HTTP 2 adapter

Public Class Methods

new(socket) click to toggle source
# File lib/polyphony/http/client/http2.rb, line 11
def initialize(socket)
  @socket = socket
  @client = HTTP2::Client.new
  @client.on(:frame) { |bytes| socket << bytes }
  # @client.on(:frame_received) do |frame|
  #   puts "Received frame: #{frame.inspect}"
  # end
  # @client.on(:frame_sent) do |frame|
  #   puts "Sent frame: #{frame.inspect}"
  # end

  @reader = spin do
    while (data = socket.readpartial(8192))
      @client << data
      snooze
    end
  end
end

Public Instance Methods

allocate_stream() click to toggle source
# File lib/polyphony/http/client/http2.rb, line 34
def allocate_stream
  @client.new_stream
end
allocate_stream_adapter() click to toggle source
# File lib/polyphony/http/client/http2.rb, line 30
def allocate_stream_adapter
  StreamAdapter.new(self)
end
protocol() click to toggle source
# File lib/polyphony/http/client/http2.rb, line 38
def protocol
  :http2
end