Default server implementations
Default server implementations
Get all the op names from default middleware automatically
Get all the op names from default middleware automatically
(default-handler & additional-middleware)
A default handler supporting interruptible evaluation, stdin, sessions, and
other basic operations (see default-middleware
).
Additional middleware to mix into the default stack may be provided; these
should all be values (usually vars) that have an nREPL middleware descriptor
in their metadata (see nrepl.middleware/set-descriptor!
).
This handler bootstraps by initiating with just the dynamic loader, then using that to load the other middleware.
A default handler supporting interruptible evaluation, stdin, sessions, and other basic operations (see `default-middleware`). Additional middleware to mix into the default stack may be provided; these should all be values (usually vars) that have an nREPL middleware descriptor in their metadata (see `nrepl.middleware/set-descriptor!`). This handler bootstraps by initiating with just the dynamic loader, then using that to load the other middleware.
Middleware vars that are implicitly merged with any additional middleware provided to nrepl.server/default-handler.
Middleware vars that are implicitly merged with any additional middleware provided to nrepl.server/default-handler.
Use nrepl.server/default-middleware
instead. Middleware
Use `nrepl.server/default-middleware` instead. Middleware
(handle handler transport)
Run a handle loop that receives requests from transport
and
asynchronously (on a separate thread) handles them using handler
. Thus,
multiple requests can be handled simultaneously. The loop stops when the
recv
from transport returns nil.
Run a handle loop that receives requests from `transport` and asynchronously (on a separate thread) handles them using `handler`. Thus, multiple requests can be handled simultaneously. The loop stops when the `recv` from transport returns nil.
(start-server &
{:keys [port bind socket tls? tls-keys-str tls-keys-file
transport-fn handler ack-port greeting-fn
consume-exception]
:or {consume-exception (fn [_] nil)}})
Starts a socket-based nREPL server. Configuration options include:
true
to use TLS.(default-handler)
nrepl.transport/tty-greeting
for an example of such
a function.Returns a (record) handle to the server that is started, which may be stopped
either via stop-server
, (.close server), or automatically via with-open
.
The port that the server is open on is available in the :port slot of the
server map (useful if the :port option is 0 or was left unspecified.
Starts a socket-based nREPL server. Configuration options include: * :port — defaults to 0, which autoselects an open port * :bind — bind address, by default "127.0.0.1" * :socket — filesystem socket path (alternative to :port and :bind). Note that POSIX does not specify the effect (if any) of the socket file's permissions (and some systems have ignored them), so any access control should be arranged via parent directories. * :tls? - specify `true` to use TLS. * :tls-keys-file - A file that contains the certificates and private key. * :tls-keys-str - A string that contains the certificates and private key. :tls-keys-file or :tls-keys-str must be given if :tls? is true. * :handler — the nREPL message handler to use for each incoming connection; defaults to the result of `(default-handler)` * :transport-fn — a function that, given a java.net.Socket corresponding to an incoming connection, will return a value satisfying the nrepl.Transport protocol for that Socket. * :ack-port — if specified, the port of an already-running server that will be connected to inform of the new server's port. Useful only by Clojure tooling implementations. * :greeting-fn - called after a client connects, receives a nrepl.transport/Transport. Usually, Clojure-aware client-side tooling would provide this greeting upon connecting to the server, but telnet et al. isn't that. See `nrepl.transport/tty-greeting` for an example of such a function. Returns a (record) handle to the server that is started, which may be stopped either via `stop-server`, (.close server), or automatically via `with-open`. The port that the server is open on is available in the :port slot of the server map (useful if the :port option is 0 or was left unspecified.
(stop-server {:keys [open-transports server-socket] :as server})
Stops a server started via start-server
.
Stops a server started via `start-server`.
(unknown-op {:keys [op transport] :as msg})
Sends an :unknown-op :error for the given message.
Sends an :unknown-op :error for the given message.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close