Skip to content

Commit

Permalink
move onDisconect before close (#637)
Browse files Browse the repository at this point in the history
  • Loading branch information
lokissdo committed May 29, 2024
1 parent b044011 commit 65235b2
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit 65235b2

Please sign in to comment.