Module: X::Streaming::API
- Included in:
- Client
- Defined in:
- x-streaming/lib/x/streaming/api.rb
Overview
The streaming method mixed into a client, which builds a streaming client of the client
The x gem includes it into X::Client. With x-core and x-streaming alone, include it yourself: X::Client.include(X::Streaming::API), or build a streaming client of a client with X::StreamingClient.new. It passes the object it is included into to the streaming client as its client, which is an X::Client, so it belongs in X::Client or a subclass.
Instance Method Summary collapse
-
#streaming(read_timeout: StreamingClient::DEFAULT_READ_TIMEOUT, max_reconnects: StreamingClient::DEFAULT_MAX_RECONNECTS, on_reconnect: nil) ⇒ StreamingClient
A client for the streaming endpoints, which reads and reconnects differently.
Instance Method Details
#streaming(read_timeout: StreamingClient::DEFAULT_READ_TIMEOUT, max_reconnects: StreamingClient::DEFAULT_MAX_RECONNECTS, on_reconnect: nil) ⇒ StreamingClient
A client for the streaming endpoints, which reads and reconnects differently
Each call builds a new streaming client, so the one a stream runs on is kept in a variable to stop it with X::StreamingClient#stop, and a streaming client that was stopped, which stays stopped, is replaced by another.
36 37 38 |
# File 'x-streaming/lib/x/streaming/api.rb', line 36 def streaming(read_timeout: StreamingClient::DEFAULT_READ_TIMEOUT, max_reconnects: StreamingClient::DEFAULT_MAX_RECONNECTS, on_reconnect: nil) StreamingClient.new(_ = self, read_timeout:, max_reconnects:, on_reconnect:) end |