Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
id: 01M50KBA3ME0Q9274A639MK6KJ
anchor: function websocket
created: 2026-10-15T20:16:37Z
norm: '1'
sig: 1b462e5d3bc33728
body_hash: aee7bf28626367fb
raw_hash: 6675f75b614405d9
lines: 673-737
---

gateway sockets must never drop a frame silently; past the backpressure limit they close so the client reconnects and re-watches
5 changes: 5 additions & 0 deletions apps/host/src/gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -672,6 +672,11 @@ async function handle(

function websocket(): Bun.WebSocketHandler<Client> {
return {
// Past the limit Bun drops frames silently, and a watch that loses one, such as a run's end,
// stays wrong; closing makes the client reconnect and re-watch. Screenshot-heavy chats replay
// tens of megabytes to a renderer that reads slowly while it draws them.
backpressureLimit: 128 * 1024 * 1024,
closeOnBackpressureLimit: true,
open(socket) {
sockets.add(socket);
log("info", "gateway.open", { user: socket.data.user, peer: socket.data.peer });
Expand Down