khatru: OnListenerRemoved wasn't being called in the most common case of a connection dropped.
This commit is contained in:
+5
-1
@@ -349,7 +349,11 @@ func (rl *Relay) removeClientAndListeners(ws *WebSocket) {
|
|||||||
if specs, ok := rl.clients[ws]; ok {
|
if specs, ok := rl.clients[ws]; ok {
|
||||||
for _, spec := range specs {
|
for _, spec := range specs {
|
||||||
// no need to cancel contexts since they inherit from the main connection context
|
// 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)
|
delete(rl.clients, ws)
|
||||||
|
|||||||
Reference in New Issue
Block a user