- Integrating Action Cable with Passenger Standalone
- Deploying ActionCable to Heroku via @SophieDeBenedetto
- Action Cable - Friend or Foe?
- Musings on HTTP/2 integration via @tenderlove on GitHub
- What HTTP/2 means for Ruby developers is also nice
module ApplicationCable
class Connection < ActionCable::Connection::Base
identified_by :current_user
def connect
self.current_user = find_verified_user
end
def session
cookies.encrypted[Rails.application.config.session_options[:key]]
end
def ability
@ability ||= Ability.new(current_user)
end
protected
def find_verified_user
User.find_by(id: session["user_id"])
end
end
end
and
module ApplicationCable
class Channel < ActionCable::Channel::Base
delegate :session, :ability, to: :connection
# dont allow the clients to call those methods
protected :session, :ability
end
end
Hey, I'm @thenthj on Twitter.
Thanks to @austinonrails for having me on May 24th, 2016. :)