From 5e84b9557868fe19c45f4da89d448e40b87a1f52 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Thu, 3 Mar 2016 21:10:10 -0500 Subject: [PATCH] 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 8b69f1eeba753c38364fb88136b2503480f2de1d. --- actioncable/app/assets/javascripts/action_cable.coffee.erb | 5 +++-- 1 file 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..d2dd8ce25f 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") ? "/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)