Open stevenwoudstra opened 7 years ago
Hey thanks for creating an issue. Mind answering some of the following questions?
rails s
puma
heroku local
, etc).Thanks for helping me ^^
"I'm running on Rail 5.0.1, i'm starting the server with rails s
but i use invoker(to run as "domain.dev") to do so.
It's running on port 3000.
I have no errors in chrome, only when i close the rails server then I get:
WebSocket connection to 'ws://fr.domain.dev/cable' failed: Connection closed before receiving a handshake response
Great, can you try this?
Just run bundle exec rails s -p 3000
. Then navigate to http://localhost:3000 in the browser and see if it works.
If it does, I'm assuming that ActionCable (what this gem uses to push updates to the browser) isn't reaching the domain your using (domain.dev
). Thankfully, it's a simple fix.
Buried deep in the ActionCable Guide: http://edgeguides.rubyonrails.org/action_cable_overview.html#allowed-request-origins
In config/environments/development.rb
add this line
config.action_cable.allowed_request_origins = ['http://localhost:3000', 'http://domain.dev']
Just replace that last url with whatever url you run your app on.
Hopefully that fixes it 🤞
I already did try run it over localhost:3000 and with bundle exec
, no change
I did indeed config action cable.
my configs for action cable:
config.action_cable.disable_request_forgery_protection = true
config.action_cable.allowed_request_origins = ['localhost:3000', 'domain1.dev', 'nl.domain2.dev', 'domain2.dev', 'en.domain2.dev']
config.action_cable.url = ["ws://nl.domain2.dev/cable", "ws://domain1.dev/cable"]
So i have no idea wy its not working, the configs are working on a mac of a colleague of mine but is does not seem to work on ubuntu.
Also it looks like action cable does have a connection with my browser because when i close my server the undefined
does change to Disconnected from server...
Hmm I'll fire up an Ubuntu 16.04 image later today and give it a spin.
okee thanks a lot ^^
So I've booted up a 16.04 image and it works. Running with Invoker as well
@stevenwoudstra Can you try and open up the page in an incognito window?
@stevenwoudstra in some versions of Ubuntu and other Linux distros the Inotify Watches Limit is too low. I think this will solve your issue.
https://confluence.jetbrains.com/display/IDEADEV/Inotify+Watches+Limit
@haffla I just tried it but it didn't work...
Sorry I think I didn't properly read your problem. Forget my comment. Your machine picks up the changes but the signal doesn't get pushed to the browser. In fact it's the same problem I'm having now (Rails 5, Ubuntu 16). I'm gonna setup a new rails project and see if it's working there.
@stevenwoudstra do you happen to use Pace? In my case it was this library that caused the problem. It is basically incompatible with ActionCable WebSockets when using the default configuration. To make it work you need to put the following JS before the Pace JS
window.paceOptions = {
ajax: {
trackWebSockets: false
}
}
Well if not check your other libraries if they mess around with Websockets.
Hi guys, I'm having some problems with the auto reload function. When I save a file I can see in my console that it is compiling end sending the reload massage to my browser(chrome) only nothing happens.
I'm running rails on a Ubuntu 16.04.2 machine.
Part of my packege.json