DEV Community

Discussion on: My Struggle With Rails ActionCable

Collapse
 
blueplanet profile image
blueplanet

Thank's for you content!!!

And , in the channel.rb , i use follwing code:

class UpdateNoticeChannel < ApplicationCable::Channel
  def subscribed
    tenant = self.connection.env['HTTP_HOST'].split('.').first
    Apartment::Tenant.switch! tenant

    stream_from "update_notice:tenant[#{tenant}]:user[#{params[:user_id]}]"
  end
end