From bf7998e780c619b4e198ad436875408150d09fe1 Mon Sep 17 00:00:00 2001 From: fiatjaf Date: Mon, 4 May 2026 13:13:02 -0300 Subject: [PATCH] khatru: OnListenerRemoved wasn't being called in the most common case of a connection dropped. --- khatru/listener.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/khatru/listener.go b/khatru/listener.go index 10e5660..454315d 100644 --- a/khatru/listener.go +++ b/khatru/listener.go @@ -349,7 +349,11 @@ func (rl *Relay) removeClientAndListeners(ws *WebSocket) { if specs, ok := rl.clients[ws]; ok { for _, spec := range specs { // no need to cancel contexts since they inherit from the main connection context - rl.dispatcher.removeSubscription(spec.ssid) + filter := rl.dispatcher.removeSubscription(spec.ssid) + + if rl.OnListenerRemoved != nil { + rl.OnListenerRemoved(ws, spec.ssid, spec.sid, filter) + } } } delete(rl.clients, ws)