Fork me on GitHub
#boot
<
2017-06-04
>
qqq22:06:14

Is there a way to configure boot-reload and webserver so that: (1) webserver is one machine (A) (2) boot-reload/cljs is on machine (B) (3) user visits webserver, which servedrs index.html + tells browser to pull js from machine (B) + connect to websoket on machine (B) ?

richiardiandrea22:06:21

@qqq I don't have an anwer off the bat but the boot-reload options helped me get that setup once

qqq22:06:57

@richiardiandrea : ah, so you're confirming that it's possible (or, at some point in time, it was opssible) ?

qqq22:06:34

(deftask remote-client-dev []
  (comp
   (watch)
   (garden :styles-var 'c.gui.css/base)
   (reload :ids #{"main"}
           :on-jsload 'c.view/init
           :target-path "../resources/local/"
           :port    4000 
           :ws-port 4000 
           :ws-host "192.168.11.101" 
           :ip "192.168.11.101") 
   (cljs :ids #{"main"}
         :optimizations :none
         :compiler-options {:source-map-timestamp true
                            :preloads             '[c.gui.preloads]})
   (target :dir #{"../resources/local/"})))
^-- current config

richiardiandrea22:06:55

The webserver and websocket server can be anywhere yes so as long as you serve the right things and configure the host correctly you should be fine. The host in boot-reload also counts because it is prepended to reloaded resources

qqq22:06:27

awesome; I was afraid some type of cross site scripting prevention thing made this impossible

qqq22:06:31

but this sounds like it's possible

richiardiandrea22:06:08

It would be great to know what actually works in detail because there are many options in boot-reload that are not necessary / misnamed. I m trying to clean up things a bit in boot-figreload ..Your mileage may vary 😀

richiardiandrea22:06:52

Well CORS is always there as a problem in dev mode so you'll need to handle it at the webserver level

richiardiandrea22:06:57

You will see coming it up and you can easily workaround it if necessary (ring has a plugin)