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

feat(gateway)!: swallow WebSocket errors #2360

Merged
merged 1 commit into from
Jul 30, 2024
Merged

Conversation

vilgotf
Copy link
Member

@vilgotf vilgotf commented Jul 6, 2024

Reading received messages on shutdown requires verbosely matching on WebSocket errors to prevent the shard from automatically reconnecting. While potentially useful for debugging, my experience is that WebSocket errors are generally just noise, and as such they are replaced with close messages with a status code of 1006 indicating abnormal closure. This has the secondary benefit of removing confusion about transport errors being somehow actionable (any internet connection may naturally error at any time for reasons outside of your control).

Reading received messages on shutdown requires verbosely matching on WebSocket errors to prevent the shard from automatically reconnecting. While potentially useful for debugging, my experience is that WebSocket errors are generally just noise, and as such they are replaced with close messages with a [status code of 1006](https://datatracker.ietf.org/doc/html/rfc6455#section-7.4.1) indicating abnormal closure. This has the secondary benefit of removing confusion about transport errors being somehow actionable (any internet connection may naturally error at any time for reasons outside of your control).
@github-actions github-actions bot added c-gateway Affects the gateway crate m-breaking change Breaks the public API. t-feature Addition of a new feature labels Jul 6, 2024
@vilgotf vilgotf merged commit f963532 into main Jul 30, 2024
9 checks passed
@vilgotf vilgotf deleted the vilgotf/swallow-ws-errors branch July 30, 2024 16:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c-gateway Affects the gateway crate m-breaking change Breaks the public API. t-feature Addition of a new feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants