diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-13 14:26:46 +0100 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2015-12-13 14:26:46 +0100 |
commit | 7328aa41c56fcb4912c9f6e6cb5fc972e446c5ba (patch) | |
tree | 71f2c42e7d94ecec70cf94f0ab363498c88fb8c3 /lib/assets | |
parent | 5fec4b96ffadf1624e6840d7446d78dba40add30 (diff) | |
parent | 62250e38a1269030e036cf23a6ea6714fb00ffac (diff) | |
download | rails-7328aa41c56fcb4912c9f6e6cb5fc972e446c5ba.tar.gz rails-7328aa41c56fcb4912c9f6e6cb5fc972e446c5ba.tar.bz2 rails-7328aa41c56fcb4912c9f6e6cb5fc972e446c5ba.zip |
Merge pull request #73 from smellsblue/websocket-url-differentiation
Easy websocket url configuration
Diffstat (limited to 'lib/assets')
-rw-r--r-- | lib/assets/javascripts/cable.coffee.erb | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/lib/assets/javascripts/cable.coffee.erb b/lib/assets/javascripts/cable.coffee.erb index 8498233c11..25a9fc79c2 100644 --- a/lib/assets/javascripts/cable.coffee.erb +++ b/lib/assets/javascripts/cable.coffee.erb @@ -4,5 +4,9 @@ @Cable = INTERNAL: <%= ActionCable::INTERNAL.to_json %> - createConsumer: (url) -> + createConsumer: (url = @getConfig("url")) -> new Cable.Consumer url + + getConfig: (name) -> + element = document.head.querySelector("meta[name='action-cable-#{name}']") + element?.getAttribute("content") |