diff --git a/app/assets/javascripts/cable.js b/app/assets/javascripts/cable.js
index 2fb3e843..0edb4a6e 100644
--- a/app/assets/javascripts/cable.js
+++ b/app/assets/javascripts/cable.js
@@ -6,7 +6,11 @@
//= require_tree ./channels
(function() {
+ var protocol = (window.location.protocol === "https:" ? "wss://" : "ws://");
+ var host = window.GreenLight.WEBSOCKET_HOST || window.location.host + window.GreenLight.RELATIVE_ROOT;
+ var url = protocol + host + '/cable';
+
this.App || (this.App = {});
- App.cable = ActionCable.createConsumer();
+ App.cable = ActionCable.createConsumer(url);
}).call(this);
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index dc4ff6a3..a47ada99 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -18,6 +18,12 @@ class ApplicationController < ActionController::Base
end
helper_method :user_name_limit
+ # Relative root helper (when deploying to subdirectory).
+ def relative_root
+ Rails.configuration.relative_url_root || ""
+ end
+ helper_method :relative_root
+
# Determines if the BigBlueButton endpoint is configured (or set to default).
def bigbluebutton_endpoint_default?
return false if loadbalanced_configuration?
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 42fbcb9a..0883f47a 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -6,6 +6,13 @@
+
+
+
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track': 'reload' %>
<%= javascript_include_tag 'application', 'data-turbolinks-track': 'reload' %>