Understand the nREPL design abstractions
masternREPL is a message-oriented, asynchronous protocol built on three primary abstractions: Handlers, Middleware, and Transports.
- Handlers: Functions that process incoming messages. An nREPL server runs a single handler for its lifetime. Handlers do not return values; instead, they use the provided
:transportto send one or more response messages back to the client. - Middleware: Higher-order functions that wrap handlers to add functionality (e.g., session management, evaluation, or custom operations). They follow patterns similar to Ring middleware.
- Transports: Implementations of the
clojure.tools.nrepl.transport.Transportprotocol that handle the encoding and transmission of messages over a channel (e.g., sockets).