Module: Firehose::Client::Consumer

Defined in:
lib/firehose/client/consumer.rb

Defined Under Namespace

Classes: HttpLongPoll, WebSocket

Constant Summary collapse

TransportNotSupportedError =

TODO - Test this libs. I had to throw these quickly into our app so that we could get

some stress testing out of the way.

TODO - Replace the integration test clients with these guys. You’ll want to refactor each

transport to use on(:message), on(:conncect), and on(:disconnect) callbacks.
Class.new(RuntimeError)

Class Method Summary collapse

Class Method Details

.parse(uri) ⇒ Object

Build up a benchmark client based on a given URI. Accepts ws:// and http:// for now.



16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/firehose/client/consumer.rb', line 16

def self.parse(uri)
  case transport = ::URI.parse(uri).scheme
  # TODO - Fix ws:// transport! See class WebSocket below to udnerstand
  # why this doesn't work and support is dropped from the CLI.
  # when 'ws'
  #   Consumer::WebSocket.new(uri)
  when 'http'
    Consumer::HttpLongPoll.new(uri)
  else
    raise TransportNotSupportedError.new("Transport #{transport.inspect} not supported.")
  end
end