I using action cable with rails 5.1.7 and it's working fine in development env and production env on locally but when it's deployed on aws ec2 it's not working. Below is the production.rb code for action cable config.
config.action_cable.url = 'wss://example.com/cable'
config.action_cable.allowed_request_origins = ["https://example.com", "https://www.example.com"]
config.action_cable.mount_path = '/cable/:token'
ActionCable.server.config.disable_request_forgery_protection = true
And cable.yml is mentioned below.
development:
adapter: async
test:
adapter: async
production:
adapter: redis
url: redis://localhost:6379/1
but the default mounted path get /cable not calling at the server config level. If I'm calling wss://example.com/cable then it's connecting but default on page load it's not connecting.
Try to install the redis add-on, with the following. My code worked with this :
cable.yml
then, to install on production (mine was on heroku) :
and I didn't need the action_cable setups in production.rb, it won't work if you leave 'myexample' expression as it is.