about summary refs log tree commit diff
path: root/app/channels/hashtag_channel.rb
blob: 5be8d94cd327aaf84efe2d3062d831a20cff536e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
class HashtagChannel < ApplicationCable::Channel
  def subscribed
    tag = params[:tag].downcase

    stream_from "timeline:hashtag:#{tag}", lambda { |encoded_message|
      status, message = hydrate_status(encoded_message)
      next if filter?(status)
      transmit message
    }
  end
end