diff options
Diffstat (limited to 'actioncable/app/javascript/action_cable/consumer.js')
-rw-r--r-- | actioncable/app/javascript/action_cable/consumer.js | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/actioncable/app/javascript/action_cable/consumer.js b/actioncable/app/javascript/action_cable/consumer.js index 51f3b60980..e2e0dea8b5 100644 --- a/actioncable/app/javascript/action_cable/consumer.js +++ b/actioncable/app/javascript/action_cable/consumer.js @@ -58,16 +58,18 @@ export default class Consumer { } export function createWebSocketURL(url) { - const webSocketURL = typeof url === "function" ? url() : url + if (typeof url === "function") { + url = url() + } - if (webSocketURL && !/^wss?:/i.test(webSocketURL)) { + if (url && !/^wss?:/i.test(url)) { const a = document.createElement("a") - a.href = webSocketURL + a.href = url // Fix populating Location properties in IE. Otherwise, protocol will be blank. a.href = a.href a.protocol = a.protocol.replace("http", "ws") return a.href } else { - return webSocketURL + return url } } |