client: Send "bye" before closing connection.

This commit is contained in:
Joachim Bauch 2025-11-24 16:31:41 +01:00
commit 87345118d8
No known key found for this signature in database
GPG key ID: 77C1D22D53E15F02

View file

@ -134,6 +134,10 @@ func (c *SignalingClient) Close() {
c.lock.Lock()
c.publicSessionId = ""
c.privateSessionId = ""
c.writeInternal(&signaling.ClientMessage{
Type: "bye",
Bye: &signaling.ByeClientMessage{},
})
c.conn.SetWriteDeadline(time.Now().Add(writeWait)) // nolint
c.conn.WriteMessage(websocket.CloseMessage, websocket.FormatCloseMessage(websocket.CloseNormalClosure, "")) // nolint
c.conn.Close()