Class: Firehose::Rack::Consumer::HttpLongPoll
- Inherits:
-
Object
- Object
- Firehose::Rack::Consumer::HttpLongPoll
- Defined in:
- lib/firehose/rack/consumer/http_long_poll.rb
Defined Under Namespace
Classes: DefaultHandler, Handler, MultiplexingHandler
Constant Summary collapse
- TIMEOUT =
How long should we wait before closing out the consuming clients web connection for long polling? Most browsers timeout after a connection has been idle for 30s.
20
Instance Attribute Summary collapse
-
#timeout ⇒ Object
Returns the value of attribute timeout.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(timeout = TIMEOUT) {|_self| ... } ⇒ HttpLongPoll
constructor
A new instance of HttpLongPoll.
Constructor Details
#initialize(timeout = TIMEOUT) {|_self| ... } ⇒ HttpLongPoll
Returns a new instance of HttpLongPoll.
13 14 15 16 |
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 13 def initialize(timeout=TIMEOUT) @timeout = timeout yield self if block_given? end |
Instance Attribute Details
#timeout ⇒ Object
Returns the value of attribute timeout.
11 12 13 |
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 11 def timeout @timeout end |
Instance Method Details
#call(env) ⇒ Object
18 19 20 21 22 23 24 |
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 18 def call(env) if Consumer.multiplexing_request?(env) MultiplexingHandler.new(@timeout).call(env) else DefaultHandler.new(@timeout).call(env) end end |