Module: Firehose::Rack

Defined in:
lib/firehose/rack.rb,
lib/firehose/rack/app.rb,
lib/firehose/rack/ping.rb,
lib/firehose/rack/consumer.rb,
lib/firehose/rack/publisher.rb,
lib/firehose/rack/consumer/web_socket.rb,
lib/firehose/rack/consumer/http_long_poll.rb

Defined Under Namespace

Modules: Helpers Classes: App, Consumer, Ping, Publisher

Constant Summary collapse

ASYNC_RESPONSE =

Evented web servers recognize the -1 HTTP code as a response deferral, which is needed to stream responses via WebSockets or HTTP long polling.

[-1, {}, []].freeze
LAST_MESSAGE_SEQUENCE_HEADER =

Normally we’d want to use a custom header to reduce the likelihood of some HTTP middleware clobbering the value. But Safari seems to ignore our CORS header instructions, so we are using ‘pragma’ because it is always allowed.

'Pragma'
RACK_LAST_MESSAGE_SEQUENCE_HEADER =

Rack wants the header to start with HTTP, so we deal with that here.

"HTTP_#{LAST_MESSAGE_SEQUENCE_HEADER.upcase.gsub('-', '_')}"
CORS_OPTIONS_MAX_AGE =

Disable CORS preflight caches for requests in development mode.

ENV['RACK_ENV'] == 'development' ? '1' : '1728000'