aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app
diff options
context:
space:
mode:
authorJon Moss <me@jonathanmoss.me>2016-02-24 18:36:55 -0500
committerJon Moss <me@jonathanmoss.me>2016-02-24 20:37:52 -0500
commit1afd414488fe73c927242e072af0ff9ab21d2599 (patch)
tree479623e7c7eeccd1911b69b9fde1077ada24311f /actioncable/app
parent8b69f1eeba753c38364fb88136b2503480f2de1d (diff)
downloadrails-1afd414488fe73c927242e072af0ff9ab21d2599.tar.gz
rails-1afd414488fe73c927242e072af0ff9ab21d2599.tar.bz2
rails-1afd414488fe73c927242e072af0ff9ab21d2599.zip
Only open Action Cable connection if data is being sent
Diffstat (limited to 'actioncable/app')
-rw-r--r--actioncable/app/assets/javascripts/action_cable/connection.coffee4
1 files changed, 3 insertions, 1 deletions
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