Fork me on GitHub
#nrepl
<
2022-11-30
>
orestis20:11:29

Can nREPL servers send unsolicited messages back to clients? Example, a nREPL server could insert a tap> sink, and forward tapped data to the nREPL client (e.g. an editor)

1
phronmophobic21:11:17

I'm pretty sure that's how printing works. The server listens to stdout/stderr and forwards those to the nrepl client for the editor to print.

dpsutton21:11:14

this happens because nrepl provides a “subscribe-out” operation which closes over the transport (i think). I don’t think there’s an easy way to ad-hoc send things back without changing some code in nrepl

phronmophobic21:11:07

It's been a while since I've looked at this, but I think something like the following should work: • create a middleware that requires the eval middleware • idempotently add a tap that will send a message to the client