1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Connection#isAlive

This commit is contained in:
Javan Makhmali 2016-02-19 10:24:17 -05:00 committed by Pratik Naik
parent 96118db335
commit ab28276713

View file

@ -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