Fork me on GitHub
#cider
<
2018-08-26
>
bozhidar12:08:34

No changes since the last 2.4 snapshots.

dcj17:08:58

I have a couple questions about nrepl.server, which I am embedding into my server-side app. 1) Is there a way to configure the initial namespace a client will be placed into (from the server?) 2) Is there a way to get notified when a nrepl client connects/disconnects? (e.g. some kind of hook?) It would be good for logging, etc.

bozhidar18:08:31

> 1) Is there a way to configure the initial namespace a client will be placed into (from the server?)

bozhidar18:08:25

Currently no. You can just do some eval changing the ns after starting the server.

bozhidar18:08:47

That’s something we can probably add.

bozhidar18:08:57

> 2) Is there a way to get notified when a nrepl client connects/disconnects? (e.g. some kind of hook?) It would be good for logging, etc.

bozhidar18:08:22

Don’t think so. But it’d be easy to add something like this.

dcj18:08:53

@bozhidar WRT notifications, is that something that could be done via middleware, or would need to be part of nrepl.server proper? For both "features", I feel they would be very helpful for embedded nrepl.server uses. When building a nrepl server into a app, one might well want to have a namespace prepared with easy access to the vars (eg the "system" var for component) and functions that would be helpful for maintenance, control, and status of the app in production. And it would be great to be able to log/monitor/alert on nrepl-client connections...

dcj18:08:18

I'm not at all handy with elisp, but since this is Clojure, I have a fighting chance. Should I tale a look/stab at these? (in my non-copious free time 😞 )

bozhidar18:08:29

> @bozhidar WRT notifications, is that something that could be done via middleware, or would need to be part of nrepl.server proper?

bozhidar18:08:40

nREPL itself.

bozhidar18:08:37

That’s one potential approach for a generic notification mechanism.

bozhidar18:08:45

(at least in broad strokes)

bozhidar18:08:10

Right now all the messages you’d get from the server are the result of some request you sent to the server.

dominicm19:08:02

Connecting and disconnecting clients is transport specific. Eg not supported by http

bozhidar21:08:43

I guess in such cases we simply won’t fire any notifications. There should probably also be some mechanism to subscribe a session to such notifications, or alternatively they can be broadcast to all sessions.