mirror of
https://github.com/oven-sh/bun
synced 2026-02-11 19:38:58 +00:00
This fixes the WebSocket hanging issue where clients would never receive the upgrade response from the server. The problem was that upgrade sockets weren't configured for streaming, so writes to the socket wouldn't actually send data. Changes: - Added socket[kEnableStreaming](true) before emitting "upgrade" event - This enables handle.ondrain which allows socket writes to work properly - Previously, socket.write() would return true but bytesWritten stayed 0 The fix matches the pattern used for CONNECT method (line 548) where streaming is already enabled. Added comprehensive test in http-websocket-upgrade.test.ts that: - Creates an HTTP server with upgrade handler - Sends WebSocket upgrade request - Verifies client receives "101 Switching Protocols" response - Test passes with fix, times out without fix This resolves the code-server WebSocket hanging issue where the WebSocket would connect but never send/receive messages. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>