From ab28276713af8503b667ecbc8c1672c187e944d7 Mon Sep 17 00:00:00 2001 From: Javan Makhmali Date: Fri, 19 Feb 2016 10:24:17 -0500 Subject: Connection#isAlive --- actioncable/app/assets/javascripts/action_cable/connection.coffee | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'actioncable/app/assets/javascripts/action_cable') 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 -- cgit v1.2.3