Class: Firehose::Rack::Consumer::HttpLongPoll::MultiplexingHandler
- Inherits:
-
Handler
- Object
- Handler
- Firehose::Rack::Consumer::HttpLongPoll::MultiplexingHandler
show all
- Defined in:
- lib/firehose/rack/consumer/http_long_poll.rb
Instance Method Summary
collapse
Methods inherited from Handler
#call, #initialize
Methods included from Helpers
#response
Instance Method Details
#handle_request(request, env) ⇒ Object
148
149
150
151
152
153
154
|
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 148
def handle_request(request, env)
subscriptions = Consumer.multiplex_subscriptions(request)
log_request request, subscriptions, env
subscriptions.each do |sub|
respond_async(sub[:channel], sub[:message_sequence], env)
end
end
|
#log_request(request, subscriptions, env) ⇒ Object
140
141
142
143
144
145
146
|
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 140
def log_request(request, subscriptions, env)
if request.post?
Firehose.logger.debug "HTTP multiplexing POST, subscribing #{subscriptions.inspect}"
else
Firehose.logger.debug "HTTP multiplexing GET with query #{env["QUERY_STRING"].inspect}"
end
end
|
#wrap_frame(channel, message) ⇒ Object
136
137
138
|
# File 'lib/firehose/rack/consumer/http_long_poll.rb', line 136
def wrap_frame(channel, message)
JSON.generate channel: channel, :message => message.payload, :last_sequence => message.sequence
end
|