diff options
Diffstat (limited to 'lib/assets/javascripts')
-rw-r--r-- | lib/assets/javascripts/cable/connection.js.coffee | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/lib/assets/javascripts/cable/connection.js.coffee b/lib/assets/javascripts/cable/connection.js.coffee index 73a40acfe4..2259ddcedd 100644 --- a/lib/assets/javascripts/cable/connection.js.coffee +++ b/lib/assets/javascripts/cable/connection.js.coffee @@ -47,13 +47,19 @@ class Cable.Connection @consumer.subscriptions.notify(identifier, "received", message) open: -> + @disconnected = false @consumer.subscriptions.reload() close: -> - @consumer.subscriptions.notifyAll("disconnected") + @disconnect() error: -> - @consumer.subscriptions.notifyAll("disconnected") + @disconnect() + + disconnect: -> + return if @disconnected + @disconnected = true + @consumer.subscriptions.notifyAll("disconnected") toJSON: -> state: @getState() |