repl
local repl
$ clj
Clojure 1.9.0
user=> (+ 1 1)
2
socket repl
start socket repl
$ clj -J-Dclojure.server.repl="{:port 5555 :accept clojure.core.server/repl}"
Clojure 1.9.0
then, connect to this socket:
- w/ telnet
$ telnet 127.0.0.1 5555 Trying 127.0.0.1... Connected to localhost. Escape character is '^]'. user=> (println "hello") hello user=> :repl/quit Connection closed by foreign host.
- w/ unravel
based on the unrepl protocol
$ unravel 127.0.0.1 5555 Unravel 0.3.0-beta connected to 127.0.0.1:5555 user=> (println "hello") hello nil
nREPL
deps.edn
{:deps
{nrepl {:mvn/version "0.4.1"}}}
start nrepl server
$ clj
Clojure 1.9.0
user=> (use '[nrepl.server :only (start-server stop-server)])
nil
user=> (defonce server (start-server :port 7888))
#'user/server
client connect to nrepl server
$ clj
Clojure 1.9.0
user=> (require '[nrepl.core :as repl])
nil
(with-open [conn (repl/connect :port 7888)]
(-> (repl/client conn 1000)
(repl/message {:op :eval :code "(+ 1 1)"})
repl/response-values))
[2]