Timeouts using anycable-rails #196
Replies: 3 comments 1 reply
-
Quick update: A co-worker of mine went through the setup with the same Ruby/Rails version using this same Rails app repo and didn't run into of these connection issues. So, that's promising. |
Beta Was this translation helpful? Give feedback.
-
Can you please provide some details? How do you launch the app and its component? What do you see in the |
Beta Was this translation helpful? Give feedback.
-
Thanks for the reply @palkan. Here's the repo. I'm starting things by running these commands each in their own terminal tab (also included in the above repo's README).
I have also double checked that Redis is running. Here's the anycable-go output when it starts up. I'm not seeing any additional anycable-go output during the disconnects/reconnects. |
Beta Was this translation helpful? Give feedback.
-
I'm running into trouble migrating a basic Rails app from the out-of-the-box Action Cable setup to AnyCable. I thought I would reach out b/c there must be something I'm over looking. Here are some details that I'm hoping will be helpful.
It's a Rails 7 app I created this morning. I'm using Ruby 2.7.6p219. The only thing I did was use the scaffold generator to create a new Message resource. Here's what my messages_channel.rb looks like.
And here's what messages_channel.js looks like.
I'm using the Rails console to broadcast (ex:
ActionCable.server.broadcast("my_messages", { test: "payload" })
). I'm checking the browser console and the Rails server log to verify my console.log's and puts are firing as expected.I first got this working with the out of the box Rails Action Cable setup. I did switch the adapter to Redis so I could broadcast from the console. I also verified I could connect, subscribe, and call my_method from Postman (external app).
Next, I followed the anycable-rails README and switched over to using AnyCable. I ran the setup generator which was very helpful. Unfortunately, I'm seeing a lot of
Socket connection to 'ws://localhost:8080/cable' failed:
errors in the browser console. It does connect after several automatic retries, but usually gets disconnected after a short time. It's pretty much unusable.I also can't connect from Postman anymore. It tries to connect for a few seconds then returns the following error.
I'm running on a Mac (M1). All the dependencies installed and start up without any issue. I don't see any errors coming from the terminal (I'm using hivemind to start them using the Procfile created by the setup generator).
Do you have any thoughts as to why I'm running into trouble getting/staying connected? Thanks for your help!
Beta Was this translation helpful? Give feedback.
All reactions