diff options
author | Jeremy Daer <jeremydaer@gmail.com> | 2016-03-03 21:12:27 -0700 |
---|---|---|
committer | Jeremy Daer <jeremydaer@gmail.com> | 2016-03-03 21:12:27 -0700 |
commit | 2cafbd311fe4ddcaf02cc838088ca24cffe80ceb (patch) | |
tree | 113c57b3fc35cd0c325e291bdcefb782d00bad23 /actioncable/app/assets/javascripts/action_cable.coffee.erb | |
parent | f8ec3a142fbfc9c6d6ddeb9ae75fd571343dcb40 (diff) | |
parent | 3e4ecbe8e6afda1f96e1e474189a09aa8d19a0a7 (diff) | |
download | rails-2cafbd311fe4ddcaf02cc838088ca24cffe80ceb.tar.gz rails-2cafbd311fe4ddcaf02cc838088ca24cffe80ceb.tar.bz2 rails-2cafbd311fe4ddcaf02cc838088ca24cffe80ceb.zip |
Merge pull request #24039 from javan/actioncable-cleanup
Action Cable: client side 💅
Diffstat (limited to 'actioncable/app/assets/javascripts/action_cable.coffee.erb')
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.coffee.erb | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.coffee.erb b/actioncable/app/assets/javascripts/action_cable.coffee.erb index 6a8b4eeb85..f0422d9d9c 100644 --- a/actioncable/app/assets/javascripts/action_cable.coffee.erb +++ b/actioncable/app/assets/javascripts/action_cable.coffee.erb @@ -4,12 +4,13 @@ @ActionCable = INTERNAL: <%= ActionCable::INTERNAL.to_json %> - createConsumer: (url = @getConfig("url")) -> + createConsumer: (url) -> + url ?= @getConfig("url") ? @INTERNAL.default_mount_path 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) |