[ActionCable] Possible feature: multiple connection classes on `ActionCable.server.config.connection_class`

Hello all!

I am building an enterprise app on Ruby 2.6.5 and Rails that uses ActionCable.

It has two different authentication schemes corresponding to the customer facing and employee facing sections of website. Likewise, I would like to be able to authenticate the ActionCable connection the same way, and be able to separate the customer & employee facing code as we have through the rest of the codebase.

ActionCable cannot use multiple classes that inherit ActionCable::Connection::Base. Additionally, the process through which ActionCable selects what connection class to use (https://github.com/rails/rails/blob/master/actioncable/lib/action_cable/engine.rb#L37) is entirely undocumented.

My current workaround is to use a class which delegates methods to both of my ActionCable::Connection::Base-inheriting classes, then silently throwing away the connection(s) that do not authenticate. Another possible workaround could be duplicating the ActionCable::Server class and mounting two separate instances on separate routes, but this seems far too heavy-handed to fix this situation.

I’d be willing to write the code and documentation & contribute it back to Rails to do something like this if it’s a feature that seems useful/necessary to you all.

Thanks all.