Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't get remote reloading to work by any means #684

Closed
IamCarbonMan opened this issue Apr 25, 2018 · 6 comments
Closed

Can't get remote reloading to work by any means #684

IamCarbonMan opened this issue Apr 25, 2018 · 6 comments

Comments

@IamCarbonMan
Copy link

I'm trying to setup lein-figwheel on an AWS dev box. I SSH into the development machine and connect to its public IP from my browser. But no matter what I try I get an error in the browser console: WebSocket connection to 'ws://localhost:3449/figwheel-ws/dev' failed: Error in connection establishment: net::ERR_CONNECTION_REFUSED. I've tried using :server-ip "<literal-ip-address>", :websocket-host :js-client-host, `:websocket-url "ws://<literal-ip-address/figwheel-ws/dev". None of these have any effect. Here's my project.clj:

(defproject tabletop "0.0.0"
  :description "Tabletop games in the browser"
  :url "https:/IamCarbonMan/tabletop"
  :dependencies [[org.clojure/clojure "1.9.0"]
                 [org.clojure/clojurescript "1.9.946"]
                 [org.clojure/core.async "0.4.474"
                  :exclusions [org.clojure/tools.reader]]
                 [ring/ring-defaults "0.3.1"]
                 [compojure "1.6.1"]]
  :plugins [[lein-figwheel "0.5.15"]
            [lein-cljsbuild "1.1.7" :exclusions [[org.clojure/clojure]]]
            [lein-ring "0.12.4"]]
  :ring {:handler example.server-handler/app
         :init tabletop.server/init}
  :source-paths ["src"]
  :cljsbuild {:builds
              [{:id "dev"
                :source-paths ["src"]
                :figwheel {:on-jsload "tabletop.core/on-js-reload"
                           :websocket-url "ws://54.213.249.100:3449/figwheel-ws/dev"}
                :compiler {:main tabletop.core
                           :asset-path "js/compiled/out"
                           :output-to "resources/public/js/compiled/example.js"
                           :output-dir "resources/public/js/compiled/out"
                           :source-map-timestamp true
                           :preloads [devtools.preload]}}
               {:id "prod"
                :source-paths ["src"]
                :compiler {:output-to "resources/public/js/compiled/example.js"
                           :main tabletop.core
                           :optimizations :advanced
                           :pretty-print false}}]}
  :figwheel {:init     user/start-server
             :destroy  user/stop-server
             :css-dirs ["resources/public/css"]}
  :aliases {"package" ["do" "clean"
                       ["cljsbuild" "once" "prod"]
                       ["ring" "uberjar"]]}
  :profiles {:dev {:dependencies [[binaryage/devtools "0.9.10"]
                                  [com.cemerick/piggieback "0.2.1"]
                                  [ring-server "0.5.0"]]
                   :clean-targets ^{:protect false} ["resources/public/js/compiled" "target"]
                   :source-paths ["src" "dev"]
                   :repl-options {:nrepl-middleware [cemerick.piggieback/wrap-cljs-repl]}}})
@bhauman
Copy link
Owner

bhauman commented Apr 26, 2018

This sounds like a caching problem of some kind, because :websocket-url does indeed work.

Remember to do a lein clean. Also, you may want to try 0.5.16-SNAPSHOT as it has improved the caching situation a bit.

@IamCarbonMan
Copy link
Author

lein clean doesn't seem to change anything. Nor does using lein-figwheel 0.5.16-SNAPSHOT. I've removed and reinstalled the whole project and tested each option again, so it's definitely not a caching problem.

@IamCarbonMan
Copy link
Author

IamCarbonMan commented Apr 26, 2018

Well, I'm an idiot. The issue was the line: :init tabletop.server/init. I haven't implemented the init function yet, removing that line fixed it, not sure why though. However, I'm now getting: socket.cljs?rel=1524715185107:71 WebSocket connection to 'ws://54.213.249.100:3449/figwheel-ws/dev/dev' failed: Error during WebSocket handshake: Unexpected response code: 404. Changing :websocket-url to "ws://${ip-address}/figwheel-ws" or using :websocket-host :js-client-host have the same error.

@bhauman
Copy link
Owner

bhauman commented Apr 26, 2018

ws://54.213.249.100:3449/figwheel-ws/dev/dev is wrong it should be
ws://54.213.249.100:3449/figwheel-ws/dev

Use:
:websocket-url ws://54.213.249.100:3449/figwheel-ws

@IamCarbonMan
Copy link
Author

I did just that, still didn't work. I'm nor sure what I changed to make it work at this point, but unless someone else has the same issue this can be closed.

@vladanghene
Copy link

I encountered the same issue, figwheel just appends the name of my build to the websocket-url.
i described more here: #683 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants