Ask A Question
You’re not receiving notifications from this thread.
How can I have two connections in ActionCable?
Colton Hagan asked in Rails
I have Notifications Channel and a Pings Channel. Notifications are identified by my devise modal Agents. But my Pings Channel needs to be identified by my other devise modal, Users. Heres some sudocode to explain better. This would be ideal:
connection.rb module ApplicationCable class Connection < ActionCable::Connection::Base identified_by :current_agent identified_by :current_user def connect self.current_agent = find_verfied_agent self.current_user = find_verfied_user end protected def find_verfied_agent if current_agent = env['warden'].user current_agent else reject_unauthorized_connection end end def find_verfied_user if current_user = env['warden'].user current_user else reject_unauthorized_connection end end end end
After searching I found this on stack overflow:
So basically the same question.