Skip to content

Commit 76ff240

Browse files
committed
fix: use proper websocket closing status
Previously, we used CloseNoStatusReceived (code 1005) for indicating that the client did not ping the server. That status code is not meant for sending to the client. Hence we switch to the status code PolicyViolation (1008).
1 parent c10488a commit 76ff240

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

internal/web/client.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,7 @@ func (c *client) listenWebsocket() {
129129
if strings.Contains(strings.ToLower(readErr.Error()), "i/o timeout") {
130130
log.Printf("No ping received from client: %v\n", c.conn.RemoteAddr())
131131

132-
closeMessage := websocket.FormatCloseMessage(websocket.CloseNoStatusReceived, "No ping received!")
132+
closeMessage := websocket.FormatCloseMessage(websocket.ClosePolicyViolation, "No ping received!")
133133

134134
writeErr := c.conn.WriteControl(websocket.CloseMessage, closeMessage, time.Now().Add(5*time.Second))
135135
if writeErr != nil {

0 commit comments

Comments
 (0)