diff --git a/web/config/application.rb b/web/config/application.rb index 2293aee1e..beaa0164e 100644 --- a/web/config/application.rb +++ b/web/config/application.rb @@ -115,7 +115,7 @@ if defined?(Bundler) # Runs the websocket gateway within the web app config.websocket_gateway_uri = "ws://localhost:#{config.websocket_gateway_port}/websocket" config.websocket_gateway_trusted_uri = "ws://localhost:#{config.websocket_gateway_port + 1}/websocket" - config.websocket_gateway_max_connections_per_user = 10 + config.websocket_gateway_max_connections_per_user = 20 config.external_hostname = ENV['EXTERNAL_HOSTNAME'] || 'localhost' config.external_port = ENV['EXTERNAL_PORT'] || 3000 diff --git a/web/config/initializers/eventmachine.rb b/web/config/initializers/eventmachine.rb index 529812127..f40e162f8 100644 --- a/web/config/initializers/eventmachine.rb +++ b/web/config/initializers/eventmachine.rb @@ -12,7 +12,7 @@ unless $rails_rake_task :connect_time_stale_client => APP_CONFIG.websocket_gateway_connect_time_stale_client, :connect_time_expire_client => APP_CONFIG.websocket_gateway_connect_time_expire_client, :connect_time_stale_browser => APP_CONFIG.websocket_gateway_connect_time_stale_browser, - :connect_time_expire_browser=> APP_CONFIG.websocket_gateway_connect_time_expire_browser, + :connect_time_expire_browser => APP_CONFIG.websocket_gateway_connect_time_expire_browser, :max_connections_per_user => APP_CONFIG.websocket_gateway_max_connections_per_user, :rabbitmq_host => APP_CONFIG.rabbitmq_host, :rabbitmq_port => APP_CONFIG.rabbitmq_port, diff --git a/web/spec/spec_helper.rb b/web/spec/spec_helper.rb index d4aedf836..3da0ac5f0 100644 --- a/web/spec/spec_helper.rb +++ b/web/spec/spec_helper.rb @@ -82,6 +82,7 @@ Thread.new do :connect_time_expire_client => 6, :connect_time_stale_browser => 4, :connect_time_expire_browser => 6, + :max_connections_per_user => 20, :rabbitmq_host => 'localhost', :rabbitmq_port => 5672, :calling_thread => current, diff --git a/websocket-gateway/lib/jam_websockets/router.rb b/websocket-gateway/lib/jam_websockets/router.rb index 18397769b..661d061fd 100644 --- a/websocket-gateway/lib/jam_websockets/router.rb +++ b/websocket-gateway/lib/jam_websockets/router.rb @@ -570,6 +570,7 @@ module JamWebsockets # protect against this user swamping the server if Connection.where(user_id: user.id).count >= @max_connections_per_user + @log.warn "user #{user.id}/#{user.email} unable to connect due to max_connections_per_user #{@max_connections_per_user}" raise SessionError, 'max_user_connections' end