chickadee » nrepl » nrepl

nrepl port #!key host backlog spawnprocedure

Listen to TCP port port number and wait for incoming connections. The host and backlog parameters are passed to tcp-listen.

host defaults to "127.0.0.1" which will allow incoming connections from the local machine only. If you plan on exposing the REPL publicly, you can specify (nrepl 1234 #:port "0.0.0.0"). Note that this has major security drawbacks as a host can easily be compromised using a REPL.

(spawn) is called for each incomming connection without arguments where current-input-port, current-output-port and current-error-port are bound to the TCP connection. spawn defaults to creating a new srfi-18 thread and printing a welcome message.

You can use tcp-addresses and tcp-port-numbers to find out where the new session is coming from.

nrepl will loop for accepting incomming connections unless spawn returns #f.