Class: ChatChannel
- Inherits:
-
ApplicationCable::Channel
- Object
- ApplicationCable::Channel
- ChatChannel
- Defined in:
- lib/templates/chat_channel.rb
Instance Method Summary collapse
- #receive(data) ⇒ Object
-
#subscribed ⇒ Object
become a subscriber of this channel.
Instance Method Details
#receive(data) ⇒ Object
9 10 11 12 13 |
# File 'lib/templates/chat_channel.rb', line 9 def receive(data) data["time"] = Time.now.strftime("at %I:%M%p") ActionCable.server.broadcast("chat_#{params[:room]}", data) RubyBotJob.perform_later data,params[:room] end |
#subscribed ⇒ Object
become a subscriber of this channel.
5 6 7 |
# File 'lib/templates/chat_channel.rb', line 5 def subscribed stream_from "chat_#{params[:room]}" end |