You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

20 lines
490 B

  1. # Be sure to restart your server when you modify this file. Action Cable runs in a loop that does not support auto reloading.
  2. module ApplicationCable
  3. class Connection < ActionCable::Connection::Base
  4. identified_by :current_user
  5. def connect
  6. self.current_user = find_verified_user
  7. end
  8. protected
  9. def find_verified_user
  10. if verified_user = env['warden'].user
  11. verified_user
  12. else
  13. reject_unauthorized_connection
  14. end
  15. end
  16. end
  17. end