Class: Orchestrator::PersistenceController
- Inherits:
-
ApiController
- Object
- ActionController::Base
- Base
- ApiController
- Orchestrator::PersistenceController
- Defined in:
- app/controllers/orchestrator/persistence_controller.rb
Constant Summary collapse
- CONTROL =
Control.instance
Instance Method Summary collapse
-
#websocket ⇒ Object
Supply a bearer_token param for oauth.
Methods inherited from Base
Instance Method Details
#websocket ⇒ Object
Supply a bearer_token param for oauth
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/controllers/orchestrator/persistence_controller.rb', line 10 def websocket hijack = request.env['rack.hijack'] if hijack && CONTROL.ready promise = hijack.call # grab user for authorization checks in the web socket user = current_user promise.then do |hijacked| ws = ::SpiderGazelle::Websocket.new(hijacked.socket, hijacked.env) WebsocketManager.new(ws, user) ws.start end throw :async # to prevent rails from complaining else render nothing: true, status: :method_not_allowed end end |