Abstractions and implementations for nREPL message transports.
A transport handles the wire-level communication between client and server -- encoding, sending, and receiving messages. nREPL ships with bencode, EDN, and TTY transport implementations.
Also provides helper functions for middleware authors: respond-to
for sending responses and safe-handle for op dispatch with error
handling.
Abstractions and implementations for nREPL message transports. A transport handles the wire-level communication between client and server -- encoding, sending, and receiving messages. nREPL ships with bencode, EDN, and TTY transport implementations. Also provides helper functions for middleware authors: `respond-to` for sending responses and `safe-handle` for op dispatch with error handling.
(bencode s)(bencode in out & [s])Returns a Transport implementation that serializes messages over the given Socket or InputStream/OutputStream using bencode.
Returns a Transport implementation that serializes messages over the given Socket or InputStream/OutputStream using bencode.
(edn s)(edn in out & [s])Returns a Transport implementation that serializes messages over the given Socket or InputStream/OutputStream using EDN.
Returns a Transport implementation that serializes messages over the given Socket or InputStream/OutputStream using EDN.
(fn-transport transport-read write)(fn-transport transport-read write close)Returns a Transport implementation that delegates its functionality to the 2 or 3 functions provided.
Returns a Transport implementation that delegates its functionality to the 2 or 3 functions provided.
(piped-transports)Returns a pair of Transports that read from and write to each other.
Returns a pair of Transports that read from and write to each other.
(respond-to msg & response-data)Send a response for msg with response-data using message's transport.
Send a response for `msg` with `response-data` using message's transport.
(safe-handle msg & body)When given a message and a number of <op handler> pairs, invoke the handler
with the op that matches message's op. If an exception is raised during
handling, send an automatic error response through the message's transport
with :<op>-error status. Special keyword :else can be used for an op to
define a catch-all handler. Handlers should be functions of 1 argument msg.
When given a message and a number of <op handler> pairs, invoke the handler with the op that matches message's op. If an exception is raised during handling, send an automatic error response through the message's transport with `:<op>-error` status. Special keyword `:else` can be used for an op to define a catch-all handler. Handlers should be functions of 1 argument `msg`.
Defines the interface for a wire protocol implementation for use with nREPL.
Defines the interface for a wire protocol implementation for use with nREPL.
(recv this)(recv this timeout)Reads and returns the next message received. Will block.
Should return nil if a message is not available after timeout
ms or if the underlying channel has been closed.
Reads and returns the next message received. Will block. Should return nil if a message is not available after `timeout` ms or if the underlying channel has been closed.
(send this msg)Sends msg. Implementations should return the transport.
Sends msg. Implementations should return the transport.
(tty s)(tty in out & [s])Returns a Transport implementation suitable for serving an nREPL backend via simple in/out readers, as with a tty or telnet connection.
Returns a Transport implementation suitable for serving an nREPL backend via simple in/out readers, as with a tty or telnet connection.
(tty-greeting transport)A greeting fn usable with nrepl.server/start-server,
meant to be used in conjunction with Transports returned by the
tty function.
Usually, Clojure-aware client-side tooling would provide this upon connecting to the server, but telnet et al. isn't that.
A greeting fn usable with `nrepl.server/start-server`, meant to be used in conjunction with Transports returned by the `tty` function. Usually, Clojure-aware client-side tooling would provide this upon connecting to the server, but telnet et al. isn't that.
Return the uri scheme associated with a transport var.
Return the uri scheme associated with a transport var.
cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |