Send close message when explicitly closing client.
This commit is contained in:
parent
9a473b9bf1
commit
2628735431
|
@ -184,6 +184,12 @@ func (c *Client) Close() {
|
|||
return
|
||||
}
|
||||
|
||||
c.mu.Lock()
|
||||
if c.conn != nil {
|
||||
c.conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) // nolint
|
||||
}
|
||||
c.mu.Unlock()
|
||||
|
||||
if atomic.LoadUint32(&c.messageProcessing) == 1 {
|
||||
// Defer closing
|
||||
atomic.StoreUint32(&c.closed, 2)
|
||||
|
|
Loading…
Reference in New Issue