cloudflare / cloudflare/moltworker
WebSocket proxy throws when forwarding reserved close code 1006
- Dominant language
- TypeScript
- Stars
- 10k
- Forks
- 1.7k
- PR merge metrics
- No merged PRs in 30d
Description
When the proxy receives a close event with code 1006 (or other reserved codes), it forwards that code with `ws.close(event.code, event.reason)`.
This throws at runtime:
`TypeError: Invalid WebSocket close code: 1006`
What I observed:
- one side of the WebSocket closed with code 1006
- proxy tried to forward 1006 directly
- request handling hung after the exception
Expected behavior:
- reserved close codes are not sent in outbound close frames
- proxy closes with a valid fallback code instead
Related PR: #259
Contributor guide
Research direction
Locate the WebSocket proxy entry point that forwards close events with ws.close(event.code, event.reason), then inspect how close codes are validated. Reproduce the 1006 case and verify that reserved codes use a valid fallback, outbound forwarding no longer throws, and request handling completes normally.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- typescript
- Domain
- networking
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100