aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app
diff options
context:
space:
mode:
Diffstat (limited to 'actioncable/app')
-rw-r--r--actioncable/app/assets/javascripts/action_cable.js7
-rw-r--r--actioncable/app/javascript/action_cable/index.js2
2 files changed, 5 insertions, 4 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.js b/actioncable/app/assets/javascripts/action_cable.js
index 280adbfa83..4efab2ed46 100644
--- a/actioncable/app/assets/javascripts/action_cable.js
+++ b/actioncable/app/assets/javascripts/action_cable.js
@@ -465,14 +465,15 @@
}
}
function createWebSocketURL(url) {
- if (url && !/^wss?:/i.test(url)) {
+ var webSocketURL = typeof url === "function" ? url() : url;
+ if (webSocketURL && !/^wss?:/i.test(webSocketURL)) {
var a = document.createElement("a");
- a.href = url;
+ a.href = webSocketURL;
a.href = a.href;
a.protocol = a.protocol.replace("http", "ws");
return a.href;
} else {
- return url;
+ return webSocketURL;
}
}
exports.Connection = Connection;
diff --git a/actioncable/app/javascript/action_cable/index.js b/actioncable/app/javascript/action_cable/index.js
index e9892ee821..e679745fd7 100644
--- a/actioncable/app/javascript/action_cable/index.js
+++ b/actioncable/app/javascript/action_cable/index.js
@@ -30,7 +30,7 @@ export function getConfig(name) {
}
export function createWebSocketURL(url) {
- const webSocketURL = typeof url === 'function' ? url() : url;
+ const webSocketURL = typeof url === "function" ? url() : url
if (webSocketURL && !/^wss?:/i.test(webSocketURL)) {
const a = document.createElement("a")