Skip to content

Commit

Permalink
fix: Close websocket connection properly.
Browse files Browse the repository at this point in the history
  • Loading branch information
mturoci committed Mar 5, 2024
1 parent ba84772 commit fedca6e
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 fedca6e

Please sign in to comment.