Action Cable: allow multiple instances of Server::Base with different configs #34714
When trying to create a separate cable instance (e.g. within an engine), we faced a problem of
We want our engine to have a separate, isolated, Cable server instance with its own configuration.
See the example app using this patch: https://github.com/palkan/engine-cable-app
This problem has been already discussed here: #27425 (comment) (we've adjusted the test from that PR as well).
The related issue not included into this patch (separate PR?): currently, only the Redis adapter supports channels prefixes. With the ability to have engined cables we'll need to isolate streams for all distributed adapters (e.g.
One potential caveat of using multiples cables within the app is the lack of isolation for channel classes, i.e. it is possible to subscribe (or at least try to) to any channel from any connection (see https://github.com/rails/rails/blob/v5.2.2/actioncable/lib/action_cable/connection/subscriptions.rb#L35).
One possible solution is to add
Another way is to get away from using Ruby class names as identifiers, and build a per-connection registry/map of identifiers->class (like it's done in https://github.com/palkan/litecable).
P.S. Thanks to @composerinteralia for pairing with me on this feature.
The text was updated successfully, but these errors were encountered:
Separate cable server allows you to:
My particular use-case is the following: I'm building a Admin Console engine for the app, I'd like to add real-time functionality in the future, but I don't want to worry about whether the main app has its own cable, will there be any conflicts, etc..
So, I want an isolated, plug-n-play, way to add real-time functionality to the app: just drop a gem and that's it.
On Wed, Feb 13, 2019 at 7:22 Vladimir Dementyev ***@***.***> wrote: @kaspth <https://github.com/kaspth> Just a friendly reminder) Rebased and ready to be merged — You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub <#34714 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ALpCsPjBEtgUFnTVUO3nqRJvQBjrbO0gks5vMz6hgaJpZM4ZUgja> .
-- — name_en: “Yuzuru Nakamura” name_ja: "中村 譲” mail: "firstname.lastname@example.org"