fix: Improve how websockets deal with timeouts and closed connections#33
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
WalkthroughThe pull request refines WebSocket proxying behavior in the server by improving close-handshake handling and goroutine coordination. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Tip 💬 Introducing Slack Agent: The best way for teams to turn conversations into code.Slack Agent is built on CodeRabbit's deep understanding of your code, so your team can collaborate across the entire SDLC without losing context.
Built for teams:
One agent for your entire SDLC. Right inside Slack. Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/server/server.go`:
- Around line 1190-1198: The loop that reads from src (calling
src.ReadMessage()) wrongly forwards websocket.CloseError codes 1005/1006/1015
directly to dst via websocket.FormatCloseMessage, which can send forbidden close
codes; update the error handling in that loop to detect a *websocket.CloseError,
map any CloseNoStatusReceived (1005), CloseAbnormalClosure (1006), or 1015 to a
safe code such as websocket.CloseGoingAway before calling
websocket.FormatCloseMessage and dst.WriteMessage, and then write the mapped
close frame (preserving the original Text if desired) so no reserved codes are
sent on the wire.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 3dba10c9-b47f-4049-b258-3247859759bd
📒 Files selected for processing (1)
internal/server/server.go
Summary by CodeRabbit