提交 2b555ee9 编写于 作者: M Matthew Draper 提交者: GitHub

Merge pull request #27416 from voray/remove-throw-from-action-cable

ActionCable should not raise when a connection is already open
......@@ -23,7 +23,7 @@ class ActionCable.Connection
open: =>
if @isActive()
ActionCable.log("Attempted to open WebSocket, but existing socket is #{@getState()}")
throw new Error("Existing connection must be closed before opening")
false
else
ActionCable.log("Opening WebSocket, current state is #{@getState()}, subprotocols: #{protocols}")
@uninstallEventHandlers() if @webSocket?
......
......@@ -2,8 +2,11 @@
{consumerTest} = ActionCable.TestHelpers
module "ActionCable.Consumer", ->
consumerTest "#connect", connect: false, ({consumer, server, done}) ->
server.on("connection", done)
consumerTest "#connect", connect: false, ({consumer, server, assert, done}) ->
server.on "connection", ->
assert.equal consumer.connect(), false
done()
consumer.connect()
consumerTest "#disconnect", ({consumer, client, done}) ->
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册