Class: ChatChannel

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

Instance Method Summary collapse

Instance Method Details

#subscribedObject



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

def subscribed
  # stream_from "some_channel"
  stream_from "ChatChannel_#{params[:id]}"

  puts "subscribed to chat #{params[:id]}"
end

#unsubscribedObject



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

def unsubscribed
  # Any cleanup needed when channel is unsubscribed
end