Class: ActivityLogChannel

Inherits:
ApplicationCable::Channel
  • Object
show all
Defined in:
app/channels/activity_log_channel.rb

Instance Method Summary collapse

Instance Method Details

#receive(data) ⇒ Object


10
11
12
# File 'app/channels/activity_log_channel.rb', line 10

def receive(data)
  ActionCable.server.broadcast("messages", {message: "ActionCable is connected and received: #{data["message"]}", topic: data["topic"].presence || "general"}) if data["namespace"] == "subscriptions"
end

#subscribedObject


2
3
4
# File 'app/channels/activity_log_channel.rb', line 2

def subscribed
  stream_from "messages"
end

#unsubscribedObject


6
7
8
# File 'app/channels/activity_log_channel.rb', line 6

def unsubscribed
  # Any cleanup needed when channel is unsubscribed
end