Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: don't log normal closures as unexpected #125

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

reneaaron
Copy link

Normal closures (1000) are currently logged as:

unexpected close error from %s: %v

https://datatracker.ietf.org/doc/html/rfc6455#section-11.7

This PR adds code 1000 to the list of expected codes to prevent these logs lines from polluting the logs.

@@ -406,6 +406,7 @@ func (s *Server) HandleWebsocket(w http.ResponseWriter, r *http.Request) {
if err != nil {
if websocket.IsUnexpectedCloseError(
err,
websocket.CloseNormalClosure, // 1000
websocket.CloseGoingAway, // 1001
websocket.CloseNoStatusReceived, // 1005
websocket.CloseAbnormalClosure, // 1006
Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Abnormal closures are currently not logged? 🤔

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants