diff --git a/actioncable/app/assets/javascripts/action_cable/connection.coffee b/actioncable/app/assets/javascripts/action_cable/connection.coffee index b1343a111c65d6a0f64f8c6d77620e707b7018c3..78028bda3c4e900e3623d61f442eb5fbb7a53e52 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