   disconnect: ->
     return if @disconnected
     @disconnected = true
-    @consumer.subscriptions.notifyAll("disconnected")
+    @subscriptions.notifyAll("disconnected")
     @monitor.recordDisconnect()

  @reopenDelay: 500

  constructor: (@consumer) ->
    @monitor = new ActionCable.ConnectionMonitor this

  send: (data) ->

        when message_types.ping
          @monitor.recordPing()
        when message_types.confirmation
          @subscriptions.notify(identifier, "connected")
        when message_types.rejection
          @subscriptions.reject(identifier)
        else
          @subscriptions.notify(identifier, "received", message)

    open: ->
      ActionCable.log("WebSocket onopen event")
      @disconnected = false
      @subscriptions.reload()

    close: ->
      ActionCable.log("WebSocket onclose event")
