diff options
Diffstat (limited to 'actioncable/app/assets/javascripts')
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable.coffee.erb | 2 | ||||
-rw-r--r-- | actioncable/app/assets/javascripts/action_cable/connection.coffee | 4 |
2 files changed, 4 insertions, 2 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable.coffee.erb b/actioncable/app/assets/javascripts/action_cable.coffee.erb index d95fe78ac5..6a8b4eeb85 100644 --- a/actioncable/app/assets/javascripts/action_cable.coffee.erb +++ b/actioncable/app/assets/javascripts/action_cable.coffee.erb @@ -9,7 +9,7 @@ getConfig: (name) -> element = document.head.querySelector("meta[name='action-cable-#{name}']") - element?.getAttribute("content") + element?.getAttribute("content") ? '/cable' createWebSocketURL: (url) -> if url and not /^wss?:/i.test(url) diff --git a/actioncable/app/assets/javascripts/action_cable/connection.coffee b/actioncable/app/assets/javascripts/action_cable/connection.coffee index ee888f567b..4244322a1e 100644 --- a/actioncable/app/assets/javascripts/action_cable/connection.coffee +++ b/actioncable/app/assets/javascripts/action_cable/connection.coffee @@ -6,9 +6,11 @@ class ActionCable.Connection @reopenDelay: 500 constructor: (@consumer) -> - @open() send: (data) -> + unless @isOpen() + @open() + if @isOpen() @webSocket.send(JSON.stringify(data)) true |