Fork me on GitHub
#figwheel-main
<
2018-09-23
>
dimovich11:09:45

we're having problems with hot reloading when multiple clients are connected to same figwheel server

dimovich11:09:09

only two computers get the broadcasts

dimovich11:09:14

which is strange

dimovich11:09:34

we've tried without :broadcast-reload and :broadcast, but in that case only one computer gets the updates (the last to have opened the page)

bhauman13:09:10

@dimovich so it should work like this. If you start figwheel main and open 5 tabs, and then change a file by perhaps adding a (prn 777) to the top level of the file. You will see 777 printed in all of the consoles.

bhauman13:09:34

Now if you restart figwheel.main

bhauman13:09:20

You will lose the reload connection all the 5 tabs.

bhauman13:09:44

and you either will have to reload them all or open new tabs.

bhauman13:09:39

Basically reloads are broadcast to all the new connections that occur to the new figwheel.main process

bhauman13:09:10

you don’t need to have :broadcast-reload true to get this behavior

bhauman13:09:21

it happens by default

bhauman13:09:39

the old tabs will still connect, but they don’t get any reloads

dimovich13:09:17

the figwheel-main process is not restarted during this time... We have 3 laptops, we all connect, but only 2 of them get the hot reloading (the last two that connected)

bhauman13:09:20

OK do me a favor and add more tabs to each of the 2 computers that connected and see if all the tabs get reloads

bhauman13:09:15

it doesn’t make sense to me that a third computer doesn’t get reloads and I can open as many tabs as I want and they all get reloads

dimovich21:09:23

I tried opening multiple tabs on my computer, but only the last opened gets reloads

bhauman13:09:40

figwheel only sees connections not computers

bhauman13:09:59

and every tab is just another connection

bhauman13:09:41

every open window is just another connection

dimovich13:09:37

we all openened 2-3 tabs

dimovich13:09:57

some tabs had hot reload, some didn't

dimovich13:09:54

it still works only on the last 2 connected computers (with 2-3 tabs open each)

bhauman13:09:48

please remove :broadcast and broadcast-reload options

dimovich13:09:49

if the computer that doesn't have hot-reload is doing a refresh, then one of the computers that is having hot-reloads doesn't get them anymore

bhauman13:09:21

well something really strange is going on

bhauman14:09:13

how are you detecting if something has reloaded?

bhauman14:09:06

also in the REPL on the computer that started the server do (figwheel.repl/conns) to see who is connected

bhauman14:09:30

and on the tabs in the computers look at the names of the sessions

bhauman14:09:00

maybe some names are shared

dimovich14:09:15

ok, will check that

bhauman14:09:18

I hope it doesn’t turn out to be some strange network configs on the server, router, or duplicate ips or something like that.

bhauman14:09:37

I’m heading to brunch now

dimovich14:09:04

thanks for your help Bruce

dimovich14:09:18

will try the tips you suggested

dimovich14:09:10

there is no figwheel.repl/conns

bhauman14:09:48

in the clojurescript repl?

bhauman14:09:52

there should be

dimovich14:09:35

ah, ye... sorry

dimovich14:09:25

figwheel.repl/conns is showing only the last connected session name

bhauman15:09:31

and that is really really weird

bhauman15:09:51

I’m wondering if the :host parameter is causing this behavior

bhauman15:09:37

Are you having a hackathon today?

dimovich15:09:53

met with some friends to work on a project, and there are 2 frontenders + 1 designer, and is really useful to have on all of the computers the hot-reloading

bhauman15:09:02

@dimovich did you set the :connect-url?

bhauman15:09:07

:connect-url “ws://[[client-hostname]]:[[client-port]]/figwheel-connect”

bhauman15:09:47

I don’t see how it would work at all if you didn’t set that

bhauman15:09:57

sorry for not thinking of this sooner

dimovich15:09:17

all clients connect to the server 192.168.100.88

dimovich15:09:06

do I directly copy the template you gave? Or do I have to fill in the ip and port?

dimovich15:09:26

this is my current config

dimovich15:09:47

for the moment only one computer gets the hot-reloading

eval202018:09:40

@clark using the latest CIDER?

clark18:09:14

showing:

;; Connected to nREPL server - 
;; CIDER 0.18.1snapshot (package: 20180923.754), nREPL 0.4.5
;; Clojure 1.9.0, Java 1.8.0_181

eval202018:09:47

a common error is to not provide a buildname - you should explicitly provide dev (or what have you) when prompted

clark18:09:09

let me try again and see if that appears

clark18:09:37

ha, this worked

clark18:09:58

should this force the user to provide a buildname?

clark18:09:26

also: thank you @eval2020 I appreciate it

eval202018:09:29

yeah, a lot of folks stumble into this

eval202018:09:40

you’re welcome

clark18:09:29

if that had worked on the first try, it would have been hands-down the most straightforward clojure/cljs build I’ve ever encountered 😄

clark18:09:30

and/or, query the user’s available builds and provide a selection, similar to how cider prompts you to select figwheel, figwheel-main, boot, shadow, etc.

clark18:09:10

not sure what makes sense here, other than that, as a totally uninformed user, I just immediately pressed enter when presented with that prompt, and the error (lisp reader error) seems disjoint from the actual failure condition

eval202018:09:23

the stacktrace is hard for sure 😉

clark18:09:54

if one was to create an issue for this, which repo would it go in?

clark18:09:04

fighweel-main? cider?

eval202018:09:30

that should be https://github.com/clojure-emacs/cider/issues - I was just checking if issue was already reported

clark18:09:49

which seems related

clark18:09:52

and you’re on it 😄

eval202018:09:13

yeah, it’s my canned response to help people out 😆

eval202018:09:39

I gotta go!

clark18:09:51

thanks again for your help, take care

slipset20:09:41

But, after having installed cljs-new, as pr instructions, I get this:

slipset20:09:56

22:04 $ clj -A:new figwheel-main hello-world.app --reagent
Usage:
  -f, --force            Force overwrite
  -h, --help             Provide this help
  -o, --output DIR       Directory prefix for project creation
  -S, --snapshot         Look for -SNAPSHOT version of the template
  -v, --verbose          Be verbose
  -V, --version VERSION  Use this version of the template
Unknown option: "--reagent"
✔ /tmp
22:04 $

slipset20:09:09

Is this me missing something obvious or is the documentation off?

clark21:09:43

@slipset I think you found a documentation error. you may have to change the command slightly to:

clj -A:new figwheel-main hello-world.app -- --reagent

clark21:09:55

note the -- separating the app name and --reagent

clark21:09:19

may be worth a PR