Class: ChatChannel

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

Instance Method Summary collapse

Instance Method Details

#received(data) ⇒ Object



8
9
# File 'app/channels/chat_channel.rb', line 8

def received(data)
end

#subscribedObject



2
3
4
5
6
# File 'app/channels/chat_channel.rb', line 2

def subscribed
  user = params[:user]
  stream_from "ChatChannel"
  ActionCable.server.broadcast("chat_channel", { message: "Hello, world!", user: user })
end

#unsubscribedObject



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

def unsubscribed
end