From 23e3e2bc2bfcc393b9164975e97d5ddc58f8bf5c Mon Sep 17 00:00:00 2001 From: Duncan Grazier Date: Tue, 20 Dec 2016 09:32:45 -0500 Subject: ActionCable should not raise when a connection is already open ActionCable was throwing a "Existing connection must be closed before opening" exception which was being picked up as a production issue in our error monitoring software. Since this happens pretty often on any device that allows the browser to sleep (mobile) this error was getting triggered often. This change removes the exception, but keeps logging the occurrence. We now return `false` to let the caller now that `open` failed. --- actioncable/app/assets/javascripts/action_cable/connection.coffee | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'actioncable/app') diff --git a/actioncable/app/assets/javascripts/action_cable/connection.coffee b/actioncable/app/assets/javascripts/action_cable/connection.coffee index 29ad676290..7fd68cad2f 100644 --- a/actioncable/app/assets/javascripts/action_cable/connection.coffee +++ b/actioncable/app/assets/javascripts/action_cable/connection.coffee @@ -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? -- cgit v1.2.3