feat(transport): keep large messages intact across relay connections (#8302)

Negotiate shared binary chunk framing below application messages and routing, with bounded logical assembly and paced writes that respect encrypted relay limits. Preserve legacy admission, reconnect state, sibling route isolation, and native single-frame upload behavior.
This commit is contained in:
Mohamed Boudra
2026-10-31 09:26:24 +07:00
committed by GitHub
parent 186c132151
commit 0be49c0620
30 changed files with 1843 additions and 253 deletions
@@ -3,6 +3,11 @@ import { MAX_WEBSOCKET_MESSAGE_BYTES } from "../websocket-message-limit.js";
export const HOST_ROUTE_OPCODE = 0x30;
export const MAX_HOST_ROUTE_ID_BYTES = 256;
export const MAX_HOST_ROUTE_HEADER_BYTES = 3 + MAX_HOST_ROUTE_ID_BYTES;
// A logical host channel crosses the 32 MiB route admission boundary. Text can
// expand sixfold when enclosed in JSON; binary adds the bounded route header.
export const MAX_HOST_CHANNEL_FRAME_BYTES = Math.floor(
(32 * 1024 * 1024 - MAX_HOST_ROUTE_HEADER_BYTES) / 6,
);
export const MAX_ROUTED_PAYLOAD_BYTES = MAX_WEBSOCKET_MESSAGE_BYTES - MAX_HOST_ROUTE_HEADER_BYTES;
export interface HostRouteFrame {
routeId: string;