aboutsummaryrefslogtreecommitdiffstats
path: root/actioncable/app/assets/javascripts/action_cable
diff options
context:
space:
mode:
authorJavan Makhmali <javan@javan.us>2016-02-19 10:24:17 -0500
committerPratik Naik <pratiknaik@gmail.com>2016-02-23 09:37:49 -0600
commitab28276713af8503b667ecbc8c1672c187e944d7 (patch)
tree1db2f8d60a2c65e1907a42982f1665e176cde2ed /actioncable/app/assets/javascripts/action_cable
parent96118db3354553399754600fabe21468b13c078a (diff)
downloadrails-ab28276713af8503b667ecbc8c1672c187e944d7.tar.gz
rails-ab28276713af8503b667ecbc8c1672c187e944d7.tar.bz2
rails-ab28276713af8503b667ecbc8c1672c187e944d7.zip
Connection#isAlive
Diffstat (limited to 'actioncable/app/assets/javascripts/action_cable')
-rw-r--r--actioncable/app/assets/javascripts/action_cable/connection.coffee6
1 files changed, 3 insertions, 3 deletions
diff --git a/actioncable/app/assets/javascripts/action_cable/connection.coffee b/actioncable/app/assets/javascripts/action_cable/connection.coffee
index b1343a111c..78028bda3c 100644
--- a/actioncable/app/assets/javascripts/action_cable/connection.coffee
+++ b/actioncable/app/assets/javascripts/action_cable/connection.coffee
@@ -16,7 +16,7 @@ class ActionCable.Connection
false
open: =>
- if @webSocket and not @isClosed()
+ if @isAlive()
console.log("[cable] Attemped to open WebSocket, but existing socket is #{@getState()}", Date.now())
throw new Error("Existing connection must be closed before opening")
else
@@ -44,8 +44,8 @@ class ActionCable.Connection
# Private
- isClosed: ->
- @isState("closing", "closed")
+ isAlive: ->
+ not @isState("closing", "closed")
isState: (states...) ->
@getState() in states