Skip to content

Commit

Permalink
fix: Close websocket connection properly. (#2278)
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci authored Mar 5, 2024
1 parent 9323f8f commit 104fc16
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions client.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,9 @@ func (c *Client) listen() {
if err != nil {
if websocket.IsUnexpectedCloseError(err, websocket.CloseGoingAway, websocket.CloseAbnormalClosure) {
echo(Log{"t": "socket_read", "client": c.addr, "err": err.Error()})
} else {
// Firefox follows spec closely and requires a close message to be sent before closing the connection.
c.conn.WriteMessage(websocket.CloseMessage, []byte{})
}
break
}
Expand Down

0 comments on commit 104fc16

Please sign in to comment.