1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00

Only send "disconnected" notification once

This commit is contained in:
Javan Makhmali 2015-08-28 17:52:46 -04:00
parent 1379e973be
commit ddfd649c11

View file

@ -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()