All Collections Frameworks AnyCable

AnyCable

AnyCable is a high-performance drop-in replacement for ActionCable in Rails

Updated

To use AnyCable on Hatchbox, you'll need to add a couple processes to your application.

Install AnyCable

Follow the AnyCable docs to install it in your Rails application.

Environment Variable

Then we want to assign a unique port to AnyCable that doesn't conflict with a Hatchbox assigned PORT for your applications.

ANYCABLE_PORT=8080

AnyCable RPC Process

Add a process named anycable with the following start command:

bundle exec anycable

This process interfaces with your Rails application.

AnyCable-Go Process

Add a process named anycable-go with the following start command:

bin/anycable-go

This process handles the incoming websocket traffic and forwards it to the RPC service.

Caddy Routes

You'll also need to tell Caddy to forward websocket requests to the AnyCable process. Under your App's Settings page, add the following to the Caddy routes:

# Forward websockets to AnyCable
reverse_proxy /cable localhost:8080

# Handle everything else as normal
%{default}

Note that port 8080 here must match the ANYCABLE_PORT environment variable you set above.