Class: ChatChannel
- Inherits:
-
ApplicationCable::Channel
- Object
- ActionCable::Channel::Base
- ApplicationCable::Channel
- ChatChannel
- Defined in:
- lib/templates/chat/chat_channel.rb
Instance Method Summary collapse
Instance Method Details
#send_message(data) ⇒ Object
9 10 11 12 13 14 |
# File 'lib/templates/chat/chat_channel.rb', line 9 def (data) content = data['message'] chat_id = data['chat_id'] chat = Chat.find(chat_id) ChatService.(chat, content, current_user) end |
#subscribed ⇒ Object
2 3 4 5 |
# File 'lib/templates/chat/chat_channel.rb', line 2 def subscribed chat = Chat.find(params[:chat_id]) stream_for(chat) end |
#unsubscribed ⇒ Object
7 |
# File 'lib/templates/chat/chat_channel.rb', line 7 def unsubscribed; end |