提交 ab282767 编写于 作者: J Javan Makhmali 提交者: Pratik Naik

Connection#isAlive

上级 96118db3
......@@ -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
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册