You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
WebSocket: apply a write high-water mark, as #7487 did for TCP #8591
A client that reads slowly makes the server hold everything sent to it. fromWebSocket's write calls ws.send(chunk) and succeeds at once, so nothing bounds that:
Workaround: I, or rather Claude :D, had to reach into ws through its private kWebSocket symbol to use ws.send's callback.
What is the feature you are proposing to solve the problem?
write hands the message to ws, then waits while the unsent bytes are past a writeHighWaterMark, as TCP writes wait for 'drain' since #7487. A message counts from ws.send until its callback.
The mark would come from an option or a context reference. request.upgrade takes no options, so a server-side socket needs the reference.
What alternatives have you considered?
A non-blocking mark: hasRoom and drained on the Writer.
A write that completes once written, leaving the counting to every caller.
changed the title [-]WebSocket `write` should wait until `ws` has written the frame[/-][+]WebSocket writer: High-water mark (without blocking)[/+]on Sep 28, 2026
changed the title [-]WebSocket writer: High-water mark (without blocking)[/-][+]WebSocket: apply a write high-water mark, as #7487 did for TCP[/+]on Sep 28, 2026
Activity
[-]WebSocket `write` should wait until `ws` has written the frame[/-][+]WebSocket writer: High-water mark (without blocking)[/+][-]WebSocket writer: High-water mark (without blocking)[/-][+]WebSocket: apply a write high-water mark, as #7487 did for TCP[/+]Add bounded WebSocket write backpressure