diff options
Diffstat (limited to 'lib/assets')
-rw-r--r-- | lib/assets/javascripts/cable.js.coffee | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/assets/javascripts/cable.js.coffee b/lib/assets/javascripts/cable.js.coffee index 07f6ba2284..eb80fd7cbf 100644 --- a/lib/assets/javascripts/cable.js.coffee +++ b/lib/assets/javascripts/cable.js.coffee @@ -47,6 +47,8 @@ class @Cable callbacks['onConnect']?() reconnect: => + @removeExistingConnection() + @clearPingWaitTimeout() @resetPingTime() @disconnected() @@ -56,6 +58,13 @@ class @Cable @connect() , @generateReconnectInterval() + removeExistingConnection: => + if @connection? + @connection.onclose = -> # no-op + @connection.onerror = -> # no-op + @connection.close() + @connection = null + resetConnectionAttemptsCount: => @connectionAttempts = 1 |