Merge pull request #27416 from voray/remove-throw-from-action-cable
ActionCable should not raise when a connection is already open
This commit is contained in:
commit
2b555ee9d7
@ -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}) ->
|
||||
|
Loading…
Reference in New Issue
Block a user