Class: Async::HTTP::Protocol::HTTP2::Client
- Inherits:
-
Protocol::HTTP2::Client
- Object
- Protocol::HTTP2::Client
- Async::HTTP::Protocol::HTTP2::Client
- Includes:
- Connection
- Defined in:
- lib/async/http/protocol/http2/client.rb
Instance Attribute Summary
Attributes included from Connection
Instance Method Summary collapse
-
#call(request) ⇒ Object
Used by the client to send requests to the remote server.
-
#initialize(stream) ⇒ Client
constructor
A new instance of Client.
- #stop_connection(error) ⇒ Object
Methods included from Connection
#close, #connected?, #multiplex, #peer, #read_in_background, #reusable?, #start_connection, #version
Constructor Details
#initialize(stream) ⇒ Client
Returns a new instance of Client.
33 34 35 36 37 38 39 |
# File 'lib/async/http/protocol/http2/client.rb', line 33 def initialize(stream) @stream = stream framer = ::Protocol::HTTP2::Framer.new(@stream) super(framer) end |
Instance Method Details
#call(request) ⇒ Object
Used by the client to send requests to the remote server.
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/async/http/protocol/http2/client.rb', line 50 def call(request) @count += 1 response = Response.new(self, next_stream_id) response.send_request(request) response.wait return response end |
#stop_connection(error) ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/async/http/protocol/http2/client.rb', line 41 def stop_connection(error) super @streams.each do |id, stream| stream.stop_connection(error) end end |