Skip to content

Commit

Permalink
fix: closing websocket connection returns invalid status code
Browse files Browse the repository at this point in the history
  • Loading branch information
Jardaliao committed Nov 18, 2023
1 parent 929d524 commit 31cf517
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion transport/connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,8 @@ func (w *gettyWSConn) writePong(message []byte) error {
// close websocket connection
func (w *gettyWSConn) close(waitSec int) {
w.updateWriteDeadline()
w.conn.WriteMessage(websocket.CloseMessage, []byte("bye-bye!!!"))
bytes := websocket.FormatCloseMessage(websocket.CloseNormalClosure, "bye-bye!!!")
w.conn.WriteMessage(websocket.CloseMessage, bytes)
conn := w.conn.UnderlyingConn()
if tcpConn, ok := conn.(*net.TCPConn); ok {
tcpConn.SetLinger(waitSec)
Expand Down

0 comments on commit 31cf517

Please sign in to comment.