rmosolgo / react-rails-hot-loader

Live-reload React.js components with Ruby on Rails & react-rails
MIT License
88 stars 24 forks source link

[HotLoader] starting WS server (ws://0.0.0.0:8082) - starts many times #17

Open rafath opened 7 years ago

rafath commented 7 years ago

rails: 5.0.1 mac os (rvm, ruby 2.4) using puma (standard command rails s) Each time I browse any page, with or without react component, in my log console I'm getting many many entries (about 67)

[HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] opened a connection (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082) [HotLoader] starting WS server (ws://0.0.0.0:8082)

What is cause of this?

rafath commented 7 years ago

It seems, that for every scss or js file - Im getting each hit, is this normal? (in dev env)

phillipp commented 7 years ago

@rafath Seems to be not normal. I have the same problem after running the dev server for a while, after a restart, problem is gone. Pretty annoying...

phillipp commented 7 years ago

@rafath I just realized that a new websocket connection is opened for each JSON XHR request. This might be the cause of the massive number of websockets and subsequent multiple reloading for a single change

criticerz commented 7 years ago

This is happening to us as well. Here is a screenshot of our logs: https://www.dropbox.com/s/tgcaffdqo208d7c/Screenshot%202017-08-07%2017.33.44.png?dl=0

It has significantly slowed down load times on dev mode.

criticerz commented 7 years ago

@rafath @phillipp I opened a pull request with the fix that solved this issue for me (https://github.com/rmosolgo/react-rails-hot-loader/pull/19)