lib/firehose/rack.rb in firehose-0.0.9 vs lib/firehose/rack.rb in firehose-0.0.10

- old
+ new

@@ -93,13 +93,21 @@ end end class App def call(env) - websocket_request?(env) ? WebSocket.new.call(env) : HttpLongPoll.new.call(env) + websocket_request?(env) ? websocket.call(env) : http_long_poll.call(env) end private + def websocket + @websocket ||= WebSocket.new + end + + def http_long_poll + @http_long_poll ||= HttpLongPoll.new + end + def websocket_request?(env) env['HTTP_UPGRADE'] =~ /websocket/i end end end \ No newline at end of file