Class: Firehose::Rack::Consumer::HttpLongPoll

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Constructor Details

#initialize(timeout = TIMEOUT) {|_self| ... } ⇒ HttpLongPoll

Returns a new instance of HttpLongPoll.

Yields:

  • (_self)

Yield Parameters:



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

#timeoutObject

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