Class: Instrumentation::RackApp
- Inherits:
-
Object
- Object
- Instrumentation::RackApp
- Defined in:
- lib/instrumentation/rack_app.rb
Overview
Main Rack application that serves the ‘websocket` data or the index page
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(report) ⇒ RackApp
constructor
A new instance of RackApp.
Constructor Details
#initialize(report) ⇒ RackApp
Returns a new instance of RackApp.
6 7 8 9 |
# File 'lib/instrumentation/rack_app.rb', line 6 def initialize(report) @report = report @view = Instrumentation::View.new end |
Instance Method Details
#call(env) ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'lib/instrumentation/rack_app.rb', line 11 def call(env) if env['HTTP_UPGRADE'] == 'websocket' socket = Tubesock.hijack(env) socket.listen @report.socket = socket [-1, {}, []] else ['200', { 'Content-Type' => 'text/html' }, [@view.render]] end end |