Class: Glib::Channel::IsTypingChannel
- Inherits:
-
ApplicationCable::Channel
- Object
- ApplicationCable::Channel
- Glib::Channel::IsTypingChannel
- Defined in:
- app/channels/glib/channel/is_typing_channel.rb
Class Attribute Summary collapse
-
.channel_name ⇒ Object
Returns the value of attribute channel_name.
Instance Method Summary collapse
Class Attribute Details
.channel_name ⇒ Object
Returns the value of attribute channel_name.
5 6 7 |
# File 'app/channels/glib/channel/is_typing_channel.rb', line 5 def channel_name @channel_name end |
Instance Method Details
#channel_name ⇒ Object
8 9 10 |
# File 'app/channels/glib/channel/is_typing_channel.rb', line 8 def channel_name self.class.channel_name end |
#subscribed ⇒ Object
12 13 14 |
# File 'app/channels/glib/channel/is_typing_channel.rb', line 12 def subscribed stream_from "#{self.class.channel_name}_#{params['conversation_id']}" end |
#typing(data) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'app/channels/glib/channel/is_typing_channel.rb', line 16 def typing(data) if data['status'] text = "#{User.find(data['user_id']).full_name} is typing" else text = '' end ActionCable.server.broadcast \ "#{self.class.channel_name}_#{params['conversation_id']}", action: { action: 'component/set', text: text, status: data['status'], user_id: data['user_id'] } end |