Class: Debugbar::DebugbarChannel

Inherits:
ActionCable::Channel::Base
  • Object
show all
Defined in:
app/channels/debugbar/debugbar_channel.rb

Instance Method Summary collapse

Instance Method Details

#receive(data) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
# File 'app/channels/debugbar/debugbar_channel.rb', line 7

def receive(data)
  if data["clear"]
    RequestBuffer.clear!
  end

  if data["ids"].present?
    RequestBuffer.remove(data["ids"])
  end

  Debugbar.connect!

  data = RequestBuffer.all.map(&:to_h)
  ActionCable.server.broadcast("debugbar_channel", data)
end

#subscribedObject



3
4
5
# File 'app/channels/debugbar/debugbar_channel.rb', line 3

def subscribed
  stream_from "debugbar_channel"
end

#unsubscribedObject



22
23
24
# File 'app/channels/debugbar/debugbar_channel.rb', line 22

def unsubscribed
  Debugbar.disconnect!
end