Class: Async::HTTP::Protocol::HTTP1::Connection
- Inherits:
- 
      Protocol::HTTP1::Connection
      
        - Object
- Protocol::HTTP1::Connection
- Async::HTTP::Protocol::HTTP1::Connection
 
- Defined in:
- lib/async/http/protocol/http1/connection.rb
Instance Attribute Summary collapse
- 
  
    
      #count  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute count. 
- 
  
    
      #version  ⇒ Object 
    
    
  
  
  
  
    
      readonly
    
    
  
  
  
  
  
  
    Returns the value of attribute version. 
Instance Method Summary collapse
- #as_json ⇒ Object
- #concurrency ⇒ Object
- #http1? ⇒ Boolean
- #http2? ⇒ Boolean
- 
  
    
      #initialize(stream, version)  ⇒ Connection 
    
    
  
  
  
    constructor
  
  
  
  
  
  
  
    A new instance of Connection. 
- #peer ⇒ Object
- #reusable? ⇒ Boolean
- #to_json ⇒ Object
- #to_s ⇒ Object
- 
  
    
      #viable?  ⇒ Boolean 
    
    
  
  
  
  
  
  
  
  
  
    Can we use this connection to make requests?. 
Constructor Details
#initialize(stream, version) ⇒ Connection
Returns a new instance of Connection.
| 17 18 19 20 21 | # File 'lib/async/http/protocol/http1/connection.rb', line 17 def initialize(stream, version) super(stream) @version = version end | 
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
| 49 50 51 | # File 'lib/async/http/protocol/http1/connection.rb', line 49 def count @count end | 
#version ⇒ Object (readonly)
Returns the value of attribute version.
| 35 36 37 | # File 'lib/async/http/protocol/http1/connection.rb', line 35 def version @version end | 
Instance Method Details
#as_json ⇒ Object
| 27 28 29 | # File 'lib/async/http/protocol/http1/connection.rb', line 27 def as_json(...) to_s end | 
#concurrency ⇒ Object
| 51 52 53 | # File 'lib/async/http/protocol/http1/connection.rb', line 51 def concurrency 1 end | 
#http1? ⇒ Boolean
| 37 38 39 | # File 'lib/async/http/protocol/http1/connection.rb', line 37 def http1? true end | 
#http2? ⇒ Boolean
| 41 42 43 | # File 'lib/async/http/protocol/http1/connection.rb', line 41 def http2? false end | 
#peer ⇒ Object
| 45 46 47 | # File 'lib/async/http/protocol/http1/connection.rb', line 45 def peer @peer ||= ::Protocol::HTTP::Peer.for(@stream.io) end | 
#reusable? ⇒ Boolean
| 60 61 62 | # File 'lib/async/http/protocol/http1/connection.rb', line 60 def reusable? @persistent && @stream && !@stream.closed? end | 
#to_json ⇒ Object
| 31 32 33 | # File 'lib/async/http/protocol/http1/connection.rb', line 31 def to_json(...) as_json.to_json(...) end | 
#to_s ⇒ Object
| 23 24 25 | # File 'lib/async/http/protocol/http1/connection.rb', line 23 def to_s "\#<#{self.class} negotiated #{@version}, #{@state}>" end | 
#viable? ⇒ Boolean
Can we use this connection to make requests?
| 56 57 58 | # File 'lib/async/http/protocol/http1/connection.rb', line 56 def viable? self.idle? && @stream&.readable? end |