From 65235b23be9a8383b68d79a377552898f49386fc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?H=C6=B0ng?= Date: Thu, 30 May 2024 00:37:29 +0700 Subject: [PATCH] move onDisconect before close (#637) --- connection.go | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/connection.go b/connection.go index 397cc6f7..539a9802 100644 --- a/connection.go +++ b/connection.go @@ -61,11 +61,10 @@ func (c *conn) Close() error { c.closeOnce.Do(func() { // for each namespace, leave all rooms, and call the disconnect handler. c.namespaces.Range(func(ns string, nc *namespaceConn) { - nc.LeaveAll() - if nh, _ := c.handlers.Get(ns); nh != nil && nh.onDisconnect != nil { nh.onDisconnect(nc, clientDisconnectMsg) } + nc.LeaveAll() }) err = c.Conn.Close()