Class: Feat::NetHTTPStreamTransport
- Inherits:
-
Object
- Object
- Feat::NetHTTPStreamTransport
- Defined in:
- lib/feat/streaming.rb
Overview
Default SSE transport built on Net::HTTP streaming reads. Injectable so tests can supply a fake that yields canned chunks.
Defined Under Namespace
Classes: Connection
Instance Method Summary collapse
-
#connect(uri:, headers:) ⇒ Object
Open a streaming GET and return a connection handle.
-
#initialize(open_timeout:, read_timeout:) ⇒ NetHTTPStreamTransport
constructor
A new instance of NetHTTPStreamTransport.
Constructor Details
#initialize(open_timeout:, read_timeout:) ⇒ NetHTTPStreamTransport
Returns a new instance of NetHTTPStreamTransport.
48 49 50 51 |
# File 'lib/feat/streaming.rb', line 48 def initialize(open_timeout:, read_timeout:) @open_timeout = open_timeout @read_timeout = read_timeout end |
Instance Method Details
#connect(uri:, headers:) ⇒ Object
Open a streaming GET and return a connection handle.
54 55 56 57 58 59 60 61 |
# File 'lib/feat/streaming.rb', line 54 def connect(uri:, headers:) http = Net::HTTP.new(uri.host, uri.port) http.use_ssl = (uri.scheme == "https") http.open_timeout = @open_timeout http.read_timeout = @read_timeout http.start Connection.new(http, uri, headers) end |