dynamically select websocket protocol

This commit is contained in:
Josh
2018-06-21 10:57:20 -04:00
parent 54adff3779
commit ad7aaa1a11
3 changed files with 18 additions and 1 deletions

View File

@ -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);