High level nREPL client support.
High level nREPL client support.
(client transport response-timeout)
Returns a fn of zero and one argument, both of which return the current head of a single response-seq being read off of the given client-side transport. The one-arg arity will send a given message on the transport before returning the seq.
Most REPL interactions are best performed via message
and client-session
on top of
a client fn returned from this fn.
Returns a fn of zero and one argument, both of which return the current head of a single response-seq being read off of the given client-side transport. The one-arg arity will send a given message on the transport before returning the seq. Most REPL interactions are best performed via `message` and `client-session` on top of a client fn returned from this fn.
(client-session client & {:keys [session clone]})
Returns a function of one argument. Accepts a message that is sent via the client provided with a fixed :session id added to it. Returns the head of the client's response seq, filtered to include only messages related to the :session id that will terminate when the session is closed.
Returns a function of one argument. Accepts a message that is sent via the client provided with a fixed :session id added to it. Returns the head of the client's response seq, filtered to include only messages related to the :session id that will terminate when the session is closed.
(code & body)
Expands into a string consisting of the macro's body's forms (literally, no interpolation/quasiquoting of locals or other references), suitable for use in an :eval message, e.g.:
{:op :eval, :code (code (+ 1 1) (slurp "foo.txt"))}
Expands into a string consisting of the macro's body's forms (literally, no interpolation/quasiquoting of locals or other references), suitable for use in an :eval message, e.g.: {:op :eval, :code (code (+ 1 1) (slurp "foo.txt"))}
(code* & expressions)
Returns a single string containing the pr-str'd representations of the given expressions.
Returns a single string containing the pr-str'd representations of the given expressions.
(combine-responses responses)
Combines the provided seq of response messages into a single response map.
Certain message slots are combined in special ways:
Combines the provided seq of response messages into a single response map. Certain message slots are combined in special ways: - only the last :ns is retained - :value is accumulated into an ordered collection - :status and :session are accumulated into a set - string values (associated with e.g. :out and :err) are concatenated
(connect &
{:keys [port host transport-fn]
:or {transport-fn transport/bencode host "localhost"}})
Connects to a socket-based REPL at the given host (defaults to localhost) and port, returning the Transport (by default clojure.tools.nrepl.transport/bencode) for that connection.
Transports are most easily used with client
, client-session
, and
message
, depending on the semantics desired.
Connects to a socket-based REPL at the given host (defaults to localhost) and port, returning the Transport (by default clojure.tools.nrepl.transport/bencode) for that connection. Transports are most easily used with `client`, `client-session`, and `message`, depending on the semantics desired.
(message client {:keys [id] :as msg :or {id (uuid)}})
Sends a message via [client] with a fixed message :id added to it. Returns the head of the client's response seq, filtered to include only messages related to the message :id that will terminate upon receipt of a "done" :status.
Sends a message via [client] with a fixed message :id added to it. Returns the head of the client's response seq, filtered to include only messages related to the message :id that will terminate upon receipt of a "done" :status.
(new-session client & {:keys [clone]})
Provokes the creation and retention of a new session, optionally as a clone of an existing retained session, the id of which must be provided as a :clone kwarg. Returns the new session's id.
Provokes the creation and retention of a new session, optionally as a clone of an existing retained session, the id of which must be provided as a :clone kwarg. Returns the new session's id.
(read-response-value {:keys [value] :as msg})
Returns the provided response message, replacing its :value string with the result of (read)ing it. Returns the message unchanged if the :value slot is empty or not a string.
Returns the provided response message, replacing its :value string with the result of (read)ing it. Returns the message unchanged if the :value slot is empty or not a string.
(response-seq transport)
(response-seq transport timeout)
Returns a lazy seq of messages received via the given Transport.
Called with no further arguments, will block waiting for each message.
The seq will end only when the underlying Transport is closed (i.e.
returns nil from recv
) or if a message takes longer than timeout
millis to arrive.
Returns a lazy seq of messages received via the given Transport. Called with no further arguments, will block waiting for each message. The seq will end only when the underlying Transport is closed (i.e. returns nil from `recv`) or if a message takes longer than `timeout` millis to arrive.
(response-values responses)
Given a seq of responses (as from response-seq or returned from any function returned by client or client-session), returns a seq of values read from :value slots found therein.
Given a seq of responses (as from response-seq or returned from any function returned by client or client-session), returns a seq of values read from :value slots found therein.
Connects to an nREPL endpoint identified by the given URL/URI. Valid examples include:
nrepl://192.168.0.12:7889 telnet://localhost:5000 http://your-app-name.heroku.com/repl
This is a multimethod that dispatches on the scheme of the URI provided (which can be a string or java.net.URI). By default, implementations for nrepl (corresponding to using the default bencode transport) and telnet (using the clojure.tools.nrepl.transport/tty transport) are registered. Alternative implementations may add support for other schemes, such as HTTP, HTTPS, JMX, existing message queues, etc.
Connects to an nREPL endpoint identified by the given URL/URI. Valid examples include: nrepl://192.168.0.12:7889 telnet://localhost:5000 http://your-app-name.heroku.com/repl This is a multimethod that dispatches on the scheme of the URI provided (which can be a string or java.net.URI). By default, implementations for nrepl (corresponding to using the default bencode transport) and telnet (using the clojure.tools.nrepl.transport/tty transport) are registered. Alternative implementations may add support for other schemes, such as HTTP, HTTPS, JMX, existing message queues, etc.
Current version of nREPL, map of :major, :minor, :incremental, and :qualifier.
Current version of nREPL, map of :major, :minor, :incremental, and :qualifier.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close