Fork me on GitHub
#figwheel-main
<
2020-04-11
>
victorb09:04:13

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

pyrmont16:04:27

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.

victorb16:04:48

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

pyrmont16:04:32

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

victorb16:04:30

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

victorb16:04:22

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

pyrmont16:04:02

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}}

pyrmont16:04:37

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

pyrmont16:04:51

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

pyrmont16:04:53

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.

pyrmont16:04:34

Anyway, something to think about! Good luck!

victorb16:04:00

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

👍 4
victorb09:04:40

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