Moved message handling out to a separate method for clarity in eventbus.
[arvados.git] / services / api / config / initializers / eventbus.rb
1 require 'eventbus'
2
3 Server::Application.configure do
4   # Enables websockets if ARVADOS_WEBSOCKETS is defined with any value.  If
5   # ARVADOS_WEBSOCKETS=ws-only, server will only accept websocket connections
6   # and return an error response for all other requests.
7   if ENV['ARVADOS_WEBSOCKETS']
8     config.middleware.insert_after ArvadosApiToken, RackSocket, {
9       :handler => EventBus,
10       :mount => "/websocket",
11       :websocket_only => (ENV['ARVADOS_WEBSOCKETS'] == "ws-only")
12     }
13   end
14
15   # Define websocket_address configuration option, can be overridden in config files.
16   # See application.yml.example for details.
17   config.websocket_address = nil
18 end