cloudflare / cloudflare/moltworker

WebSocket proxy throws when forwarding reserved close code 1006

Open Beginner friendly
#260 1 comment 0 reactions 0 assignees View on GitHub
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

Open the contributing 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.