Class: UV::HttpEndpoint::Connection
- Inherits:
-
OutboundConnection
- Object
- Connection
- TcpConnection
- OutboundConnection
- UV::HttpEndpoint::Connection
- Defined in:
- lib/uv-rays/http_endpoint.rb
Instance Attribute Summary collapse
-
#reason ⇒ Object
Returns the value of attribute reason.
-
#request ⇒ Object
Returns the value of attribute request.
Attributes inherited from Connection
Instance Method Summary collapse
- #close_connection(request = nil) ⇒ Object
-
#initialize(host, port, tls, client) ⇒ Connection
constructor
A new instance of Connection.
-
#on_close ⇒ Object
user to define.
-
#on_connect(transport) ⇒ Object
user to define.
-
#on_read(data, *args) ⇒ Object
user to define.
- #post_init(*args) ⇒ Object
Methods inherited from OutboundConnection
Methods inherited from TcpConnection
#keepalive, #stream_file, #write
Methods inherited from Connection
Constructor Details
#initialize(host, port, tls, client) ⇒ Connection
Returns a new instance of Connection.
38 39 40 41 42 43 |
# File 'lib/uv-rays/http_endpoint.rb', line 38 def initialize(host, port, tls, client) @client = client @request = nil super(host, port) use_tls(client.) if tls end |
Instance Attribute Details
#reason ⇒ Object
Returns the value of attribute reason.
45 46 47 |
# File 'lib/uv-rays/http_endpoint.rb', line 45 def reason @reason end |
#request ⇒ Object
Returns the value of attribute request.
45 46 47 |
# File 'lib/uv-rays/http_endpoint.rb', line 45 def request @request end |
Instance Method Details
#close_connection(request = nil) ⇒ Object
64 65 66 67 68 69 70 71 |
# File 'lib/uv-rays/http_endpoint.rb', line 64 def close_connection(request = nil) if request.is_a? Http::Request @request = request super(:after_writing) else super(request) end end |
#on_close ⇒ Object
user to define
58 59 60 61 62 |
# File 'lib/uv-rays/http_endpoint.rb', line 58 def on_close # user to define req = @request @request = nil @client.connection_closed(req, @reason) end |
#on_connect(transport) ⇒ Object
user to define
54 55 56 |
# File 'lib/uv-rays/http_endpoint.rb', line 54 def on_connect(transport) # user to define @client.connection_ready end |
#on_read(data, *args) ⇒ Object
user to define
47 48 49 |
# File 'lib/uv-rays/http_endpoint.rb', line 47 def on_read(data, *args) # user to define @client.data_received(data) end |
#post_init(*args) ⇒ Object
51 52 |
# File 'lib/uv-rays/http_endpoint.rb', line 51 def post_init(*args) end |