figwheel-main

figwheel-main http://figwheel.org
victorb 2020-04-11T09:22:13.015800Z

is there a way I can manually connect to a remote running figwheel repl? Basically, I want to set `:connect-url` dynamically in my cljs runtime, and manually trigger the connect, rather than automatically and hardcoded connect-url in the build

victorb 2020-04-11T09:23:05.015900Z

make sure you only include figwheel-main in your dev profile

victorb 2020-04-11T09:23:27.016100Z

looks something like this for me

victorb 2020-04-11T09:35:40.016900Z

seems I should be able to use figwheel.repl/connect somehow to do this, from https://github.com/bhauman/figwheel-repl/blob/master/src/figwheel/repl/preload.cljs

pyrmont 2020-04-11T16:18:27.020800Z

This isn't exactly what you had in mind and so maybe won't scratch your particular itch but I run Figwheel on a remote server. My solution is to run Node, use that as the 'default' client and then set all Figwheel to broadcast all messages to all clients.

pyrmont 2020-04-11T16:19:04.021200Z

Here's my Node script: https://github.com/pyrmont/pondent/blob/master/fig.js

victorb 2020-04-11T16:19:48.021500Z

Hm, I see. Yeah, not sure if it's helpful. Basically, what I want to be able to do, is stop figwheel from making the client > server connection automatically, and make it on-demand, so I can ship it to our staging environment as well, and if testers/product team finds issues, they can click one button for me to get a live repl session into their browser session. If that makes sense

pyrmont 2020-04-11T16:20:32.022200Z

No, it does. It's an interesting idea. I never thought about trying to do it that way.

victorb 2020-04-11T16:21:30.022500Z

Yeah, currently have a kind of manual step, where there is a debug bar with a button that takes the app-db re-frame is using, serializes it and POST it to a server that stores it and gives a ID back, then testers/product send me that ID and I can inject the session locally. Just want to make it a bit smoother and with a live env as well

victorb 2020-04-11T16:23:22.023600Z

I might just open a issue in figwheel-main instead, get more eyes and maybe someone has a solution already. Thanks a lot though @mike858 🙂

pyrmont 2020-04-11T16:24:02.023900Z

Here's my dev environment:

^{:watch-dirs ["src", "test"]
  :broadcast true
  :css-dirs ["resources/public/css"]
  :cljs-devtools false
  :launch-js ["node" "fig.js" :open-url]
  :open-url "<http://[%5Bserver-hostname%5D]:%5B%5Bserver-port%5D%5D/index.html|http://[[server-hostname]]:[[server-port]]/index.html>"
  :ring-server-options {:host <server URL> :port 8000}}
{:main pondent.core}}

pyrmont 2020-04-11T16:26:37.025100Z

If you had your testers run this on their machines, you'd be able to connect to their instances.

pyrmont 2020-04-11T16:26:51.025700Z

It wouldn't give you the REPL session, though. So isn't quite what you want.

pyrmont 2020-04-11T16:29:53.028500Z

Oh, well, no, it would give you that on the staging server. You'd have to SSH into that and access the REPL remotely. The problem would be that every tester would be receiving all messages from every other connected user which I think might bork things if you have more than one tester at a time.

pyrmont 2020-04-11T16:31:34.029500Z

Anyway, something to think about! Good luck!

victorb 2020-04-11T16:34:00.029700Z

Hm, interesting. Yeah, might be able to turn it around somehow with what you gave me. Thanks a lot!

1👍