diff options
Diffstat (limited to 'actioncable')
-rw-r--r-- | actioncable/app/javascript/action_cable/index.js | 8 |
1 files changed, 2 insertions, 6 deletions
diff --git a/actioncable/app/javascript/action_cable/index.js b/actioncable/app/javascript/action_cable/index.js index 1fd391a2c9..e9892ee821 100644 --- a/actioncable/app/javascript/action_cable/index.js +++ b/actioncable/app/javascript/action_cable/index.js @@ -30,12 +30,8 @@ export function getConfig(name) { } export function createWebSocketURL(url) { - let webSocketURL - if (typeof url === 'function') { - webSocketURL = url() - } else { - webSocketURL = url - } + const webSocketURL = typeof url === 'function' ? url() : url; + if (webSocketURL && !/^wss?:/i.test(webSocketURL)) { const a = document.createElement("a") a.href = webSocketURL |