Skip to content
This repository was archived by the owner on Sep 29, 2024. It is now read-only.

Commit 65235b2

Browse files
authored
move onDisconect before close (#637)
1 parent b044011 commit 65235b2

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

connection.go

+1-2
Original file line numberDiff line numberDiff line change
@@ -61,11 +61,10 @@ func (c *conn) Close() error {
6161
c.closeOnce.Do(func() {
6262
// for each namespace, leave all rooms, and call the disconnect handler.
6363
c.namespaces.Range(func(ns string, nc *namespaceConn) {
64-
nc.LeaveAll()
65-
6664
if nh, _ := c.handlers.Get(ns); nh != nil && nh.onDisconnect != nil {
6765
nh.onDisconnect(nc, clientDisconnectMsg)
6866
}
67+
nc.LeaveAll()
6968
})
7069
err = c.Conn.Close()
7170

0 commit comments

Comments
 (0)