Class: Firehose::Client::Consumer::WebSocket
- Inherits:
-
Object
- Object
- Firehose::Client::Consumer::WebSocket
- Defined in:
- lib/firehose/client/consumer.rb
Overview
TODO - This won’t even work. Dropping ws:// above until this is tested. This thing should be sending message sequences to Firehose. Connect to Firehose via WebSockets and consume messages.
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#initialize(url, logger = Firehose.logger) ⇒ WebSocket
constructor
A new instance of WebSocket.
- #request ⇒ Object
Constructor Details
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
33 34 35 |
# File 'lib/firehose/client/consumer.rb', line 33 def logger @logger end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
33 34 35 |
# File 'lib/firehose/client/consumer.rb', line 33 def url @url end |
Instance Method Details
#request ⇒ Object
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/firehose/client/consumer.rb', line 39 def request ws = Faye::WebSocket::Client.new(url) ws. = lambda do |event| logger.info "WS | #{event.data[0...40].inspect}" end ws.onclose = lambda do |event| logger.info "WS | Closed" end ws.onerror do logger.error "WS | Failed" end end |