Fork me on GitHub
#nrepl
<
2019-09-16
>
thheller08:09:30

can any nREPL expert tell me if it is possible for a nREPL middleware to be notified when a nREPL connection is terminated/disconnected?

thheller08:09:41

ie. a middleware received a message and started something running in a separate thread. how do I terminate that thread if the underlying nrepl connection closed and no further messages will come?

thheller08:09:29

maybe even better at the session level? or is there no explicit "this session has ended"?

shen08:09:00

Just had a look through the source, and looks like when a client disconnects, it dies here: https://github.com/nrepl/nrepl/blob/5aca552d2081ef2f7f0410ce18f2436efd7f30e0/src/clojure/nrepl/server.clj#L56

shen08:09:12

i'm not aware of any "connection" closed messages

shen08:09:31

though it's not clear a connection ending is the end of a session.