Skip to content

Adopt configurable Action Cable server#9

Open
samuel-williams-shopify wants to merge 1 commit into
mainfrom
server-configuration
Open

Adopt configurable Action Cable server#9
samuel-williams-shopify wants to merge 1 commit into
mainfrom
server-configuration

Conversation

@samuel-williams-shopify

Copy link
Copy Markdown
Contributor

Motivation

This builds on the proposed Rails server configuration hook in rails/rails#57803. Instead of inserting Async::Cable::Middleware into the Rails middleware stack while ActionCable.server remains a default ActionCable::Server::Base, this configures Action Cable itself to use an async server implementation.

That keeps the mounted Rack endpoint, ActionCable.server.broadcast, remote connections, pub/sub, heartbeat state, and channel internals on the same server object.

Changes

  • Add Async::Cable::Server, a subclass of ActionCable::Server::Base that handles Rack WebSocket requests with async-websocket.
  • Override #executor to use Async::Cable::Executor.
  • Update the Railtie to set app.config.action_cable.server = Async::Cable::Server before Action Cable copies Rails config.
  • Keep Async::Cable::Middleware available for compatibility, but no longer use it in the Railtie path.
  • Point development/test Rails dependency at samuel-williams-shopify/rails, branch action-cable-configurable-server, so CI can exercise the pending Rails hook.
  • Update README, getting started guide, gemspec comments, and release notes.

Verification

  • bundle exec sus
  • bundle exec rubocop
  • bundle exec bake covered:validate
  • bundle exec bake decode:index:coverage lib

Depends on rails/rails#57803.

Assisted-By: devx/edbcc7bd-6e27-4da8-bd2e-43c275487564
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant