Class: H2::Server::HTTP

Inherits:
H2::Server show all
Defined in:
lib/h2/server.rb

Overview

‘h2c’ server - for plaintext HTTP/2 connection

NOTE: browsers don’t support this and probably never will

Constant Summary

Constants inherited from H2::Server

TCP_DEFAULT_BACKLOG

Instance Method Summary collapse

Methods inherited from H2::Server

#goaway, #handle_connection, #handle_push_promise, #handle_stream, #shutdown

Constructor Details

#initialize(host:, port:, **options, &on_connection) ⇒ HTTP

create a new h2c server



85
86
87
88
89
# File 'lib/h2/server.rb', line 85

def initialize host:, port:, **options, &on_connection
  @tcpserver = Celluloid::IO::TCPServer.new host, port
  options.merge! host: host, port: port
  super @tcpserver, options, &on_connection
end

Instance Method Details

#runObject



91
92
93
# File 'lib/h2/server.rb', line 91

def run
  loop { async.handle_connection @server.accept }
end