This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2021-01-05
Channels
- # announcements (14)
- # babashka (51)
- # beginners (154)
- # calva (24)
- # cider (4)
- # clj-kondo (24)
- # cljfx (11)
- # cljs-dev (3)
- # clojure (259)
- # clojure-europe (14)
- # clojure-nl (2)
- # clojure-seattle (8)
- # clojure-spec (6)
- # clojure-taiwan (1)
- # clojure-uk (52)
- # clojurescript (123)
- # conjure (43)
- # core-async (15)
- # datomic (14)
- # events (1)
- # fulcro (90)
- # helix (7)
- # jobs (6)
- # meander (10)
- # nrepl (1)
- # off-topic (13)
- # pathom (1)
- # portal (8)
- # re-frame (7)
- # reveal (11)
- # shadow-cljs (99)
- # spacemacs (11)
- # testing (11)
- # vim (63)
(def server (nrepl-server/start-server :port 35379))
(def conn (nrepl/connect :port 35379))
(nrepl/message (nrepl/client conn 1000)
{:op "eval" :code "(dotimes [i 3] (Thread/sleep 1000) (println (str \"==> \" i)))"})
;; => ()
(def f (nrepl/client conn 1000))
(f)
;; => ({:id "7a5fa37e-41ec-435b-b63c-5d58b611f4ac",
;; :out "==> 0\n",
;; :session "19c38d39-e6fd-4026-8aae-2f7a307c95d3"}
;; {:id "7a5fa37e-41ec-435b-b63c-5d58b611f4ac",
;; :out "==> 1\n",
;; :session "19c38d39-e6fd-4026-8aae-2f7a307c95d3"}
;; {:id "7a5fa37e-41ec-435b-b63c-5d58b611f4ac",
;; :out "==> 2\n",
;; :session "19c38d39-e6fd-4026-8aae-2f7a307c95d3"}
;; {:id "7a5fa37e-41ec-435b-b63c-5d58b611f4ac",
;; :ns "user",
;; :session "19c38d39-e6fd-4026-8aae-2f7a307c95d3",
;; :value "nil"}
;; {:id "7a5fa37e-41ec-435b-b63c-5d58b611f4ac",
;; :session "19c38d39-e6fd-4026-8aae-2f7a307c95d3",
;; :status ["done"]})
Just some basic questions concerning the code above. The documentation of nrepl/client
says "Most REPL interactions are best performed via message and client-session on top of
a client fn returned from this fn." So I am just wondering what the usual workflow is when reading stuff from the client and why I shouldn't use the f
directly as above. message
and client-session
both seem to take a message as argument. What is the usual way to read repsonses asynchronously?