websocket icon indicating copy to clipboard operation
websocket copied to clipboard

failed to close WebSocket: received header with unexpected rsv bits set: true:true:true

Open switchupcb opened this issue 1 year ago • 2 comments

What is the error type of this error so I can ignore it?

Here is an example of an error type within this library.

closeErr := new(websocket.CloseError)
if errors.As(err, closeErr) {
...
}

websocket.CloseError is an error type within this library.

So, what error type is returned when you receive the error failed to close WebSocket: received header with unexpected rsv bits set: true:true:true?

switchupcb avatar Feb 20 '25 17:02 switchupcb

Currently there's no specific error type when this happens, it's a plain fmt.Errorf error. Could you share a bit more context as to why this is happening and why you consider the error to be OK to ignore?

mafredri avatar Feb 20 '25 22:02 mafredri

Could you share a bit more context as to why this is happening and why you consider the error to be OK to ignore? — @mafredri

This error happens when you attempt to close a connected websocket.

Here is the code that causes this error (when the error is not ignored).

disconnect() closes a websocket: https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager.go#L267

  • which can be pushed to https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager.go#L170
  • which can be read from https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_listener.go#L19
  • which is connected at https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager_actions.go#L191

disconnect() definition: https://github.com/switchupcb/disgo/blob/v10/wrapper/session_routine_manager_actions.go#L298

It is OK to ignore because my code works when I ignore it.

switchupcb avatar Feb 21 '25 00:02 switchupcb