1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Fix location of default mount path value

#getConfig was implmented as general utility for reading action-cable-* meta tags (hence the `name` argument). Introduced in 8b69f1eeba.
This commit is contained in:
Javan Makhmali 2016-03-03 21:10:10 -05:00
parent f8ec3a142f
commit 5e84b95578

View file

@ -4,12 +4,13 @@
@ActionCable =
INTERNAL: <%= ActionCable::INTERNAL.to_json %>
createConsumer: (url = @getConfig("url")) ->
createConsumer: (url) ->
url ?= @getConfig("url") ? "/cable"
new ActionCable.Consumer @createWebSocketURL(url)
getConfig: (name) ->
element = document.head.querySelector("meta[name='action-cable-#{name}']")
element?.getAttribute("content") ? '/cable'
element?.getAttribute("content")
createWebSocketURL: (url) ->
if url and not /^wss?:/i.test(url)