stimulusreflex / cable_ready

Use simple commands on the server to control client browsers in real-time
https://cableready.stimulusreflex.com
MIT License
737 stars 68 forks source link

documentation: Mention cable.yml adapter configuration #66

Closed phillipspc closed 3 years ago

phillipspc commented 3 years ago

I was following along with the Setup documentation, just trying to get the most basic example to work, and was completely stumped. Nothing I did seemed to update the page. After much frustration, I nearly gave up on trying to use cable ready altogether, but luckily stumbled across a user post on this GoRails video: https://gorails.com/episodes/how-to-use-cable-ready mentioning the cable.yml file. So finally after changing my development environment to adapter: postgresql, everything started to work. It's not totally clear to me why the adapter: async was not working, so perhaps I'm missing something, but suffice it to say, changing this file was key to getting things setup.

I fully recognize that this is more of an ActionCable specific thing than a CableReady thing, but for me, part the appeal of CableReady is that it simplifies using ActionCable, aka, I don't need to be an ActionCable expert to use it. So all that said, since it seems like I'm not the first person to get hung up by this cable.yml config file, perhaps it's worth mentioning in the setup docs? Even a single line like: "Be sure you're using the correct adapter in your config/cable.yml file" would have helped me tremendously.

Just a suggestion. Happy to submit a PR to update the docs if that would help.

leastbad commented 3 years ago

Hi Phillip! I am sorry to hear that you were having trouble, and I'm very glad that you got sorted out. It's a shame that you didn't come on Discord, as there's dozens of us waiting there to help.

It's true: ActionCable needs to be set up and working properly or else CableReady and StimulusReflex cannot work. That said, the AC docs are terrible. The good news is that there's not a ton you need to know about AC to get started with CR/SR, but that doesn't help you if you're stuck.

For what it's worth, the async adapter should work just fine. That said, as we can see on the GoRails comments, you're not the first person to run into this problem. Are you working on your localhost? Any virtualization or something that might be atypical?

Anyhow, the CableReady documentation is overdue for a major overhaul. It's coming, and I will certainly add information about cable.yml.

phillipspc commented 3 years ago

@leastbad thanks for the reply. I'll definitely check out the Discord in the future. To follow up, I don't think there's anything too atypical about my setup. I was trying to trigger DOM updates via CableReady both from the rails console and from active job. Neither worked at first. Switching to adapter: postgresql immediately got it working from the console. I was still having issues from ActiveJob, but I was trying out GoodJob, which is very new, and sure enough switching to DelayedJob has gotten it working via background jobs. 🤷

Thanks again, looking forward to the updated docs, and using CableReady more!

leastbad commented 3 years ago

I saw GoodJob's announcement but I am a Redis/Sidekiq enthusiast. If you're going into production, I would strongly consider using Redis/Sidekiq for caching, jobs and Action Cable.

henrydjacob commented 1 year ago

@phillipspc did you got it work on GoodJob or DelayedJob