Skip to content

Implement client WebSocket.bufferedAmount#31761

Open
robobun wants to merge 13 commits into
mainfrom
farm/91e7f8dc/ws-client-buffered-amount
Open

Implement client WebSocket.bufferedAmount#31761
robobun wants to merge 13 commits into
mainfrom
farm/91e7f8dc/ws-client-buffered-amount

Implement client WebSocket.bufferedAmount

cbec6b8
Select commit
Loading
Failed to load commit list.
Claude / Claude Code Review completed Jun 3, 2026 in 20m 17s

Code review found 1 potential issue

Found 3 candidates, confirmed 1. See review comments for details.

Details

Severity Count
🔴 Important 0
🟡 Nit 1
🟣 Pre-existing 0
Severity File:Line Issue
🟡 Nit src/jsc/bindings/webcore/WebSocket.cpp:1223-1241 bufferedAmount resets to 0 after close() instead of retaining backlog

Annotations

Check warning on line 1241 in src/jsc/bindings/webcore/WebSocket.cpp

See this annotation in the file changed.

@claude claude / Claude Code Review

bufferedAmount resets to 0 after close() instead of retaining backlog

After `ws.close()` (or `terminate()`), `bufferedAmount` drops back to 0 even if a large backlog was queued, because `m_connectedWebSocketKind` is set to `None` and the fallback `m_bufferedAmount` is always 0 (its only writer, `WebSocket__didClose`, hardcodes `0` for `unhandledBufferedAmount`). The WHATWG spec says the number must not reset once the connection closes; consider snapshotting `getBufferedAmount` into `m_bufferedAmount` in `close()`/`terminate()` just before clearing `m_connectedWebS