Transferring values ​​from a remote nrepl

I have a remote nrepl that I started from the Screen screen, which I connect to using lein repl: connect. Can I pass a value to a local replica? The reason I ask is this:

  • Using the screen means that I get headless exceptions when I want to perform graphical operations and
  • Sometimes I would like to get a local copy of the remote value for playback.
+4
source share
2 answers

As far as I know, there is no transport protocol for sending actual Clojure values ​​through wiring. What you can do is start the local nREPL server, connect to the remote instance and read / evaluate the response values ​​locally. It should be pretty simple when you are just trying to copy master data from one side to the other. Check the nREPL documentation on how to connect to the server programmatically .

Directly copying things like the state of a java object is actually impossible. You can work around this by creating a new object based on input received from a remote computer, provided that you have a local copy of the source code. The same applies to rendering graphics, obtaining state as data from the remote control, and using it locally to start rendering.

Hope this helps!

+1
source

I assume that your remote process has an open nrepl port that you are connecting to. If so, the best way to connect to this nrepl port from your local machine is probably the ssh tunnel.

ssh -L: localhost: remote-host

Then you can connect nrepl to this port on localhost and do whatever you want.

0
source

Source: https://habr.com/ru/post/1487414/


All Articles