Cargo watch: force Chrome to reload?

My webapp has two parts:
(1) rust/wasm32, running in browser, built via cargo wb start --auto-reload ...
(2) rust/x86, running rocket, built via cargo watch

Now, when I modify a file, both (1) and (2) starts recompiling. Often times, (1) finishes before (2), so the wasm32 starts executing, tries to talk rocket (still recompiling) and the ajax fails.

Is there a way in (2) to have cargo watch, upon completion, to force Chrome to reload?

I've only tried it with Actix, but there's a tool that makes a server appear to be up 100% of the time, even when it's being recompiled and restarted.

This way even when you make ajax request to the server, it won't fail, it'll just wait for the server to come back up again.

3 Likes
  1. I gave up on rocket because (a) my unmodified code did not work and (b) I didn't realize I had to use listenfd to create a listener from the ENV variables that systemfd creates. I don't see any obstacles to getting systemfd/rocket working.

  2. Everything works nicely with systemfd/actix. This is very cool. Thanks!