diff --git a/dist/BunHttpServer.js b/dist/BunHttpServer.js index 5fb0cbacc183b58e31a442badf4aef06bebcd592..e31fb00c430821fc06247079091a93fb15a1ab92 100644 --- a/dist/BunHttpServer.js +++ b/dist/BunHttpServer.js @@ -45,6 +45,20 @@ export const make = /*#__PURE__*/Effect.fnUntraced(function* (options) { ...options, fetch: handlerStack[0], websocket: { + // Patch: upstreamed as https://github.com/Effect-TS/effect/pull/6691 (ships + // in >= 4.0.0-beta.103 as the layer option `websocket: { ... }`). On + // upgrade: drop this patch and pass the option in apps/server/src/server.ts. + // Negotiate permessage-deflate with clients that offer it; clients that + // don't still get uncompressed frames on their connection. A dedicated + // compressor keeps a per-connection sliding window (context takeover) so + // the compression dictionary is shared across server-to-client frames. + // Decompression uses the shared decompressor: uWebSockets' dedicated + // decompressor path can abort connections (close 1006) on valid DEFLATE + // input — see https://github.com/uNetworking/uWebSockets.js/issues/633. + perMessageDeflate: { + compress: "dedicated", + decompress: "shared" + }, open(ws) { Deferred.doneUnsafe(ws.data.deferred, Exit.succeed(ws)); }, diff --git a/src/BunHttpServer.ts b/src/BunHttpServer.ts index 9f2ac3dfc018e2d35c6f44785f1ce05e2e06fc7c..f2bd3def712677ae1e7d475f5eaf27ac2e42ae1a 100644 --- a/src/BunHttpServer.ts +++ b/src/BunHttpServer.ts @@ -90,6 +90,20 @@ export const make = Effect.fnUntraced( ...options as ServeOptions, fetch: handlerStack[0], websocket: { + // Patch: upstreamed as https://github.com/Effect-TS/effect/pull/6691 (ships + // in >= 4.0.0-beta.103 as the layer option `websocket: { ... }`). On + // upgrade: drop this patch and pass the option in apps/server/src/server.ts. + // Negotiate permessage-deflate with clients that offer it; clients that + // don't still get uncompressed frames on their connection. A dedicated + // compressor keeps a per-connection sliding window (context takeover) so + // the compression dictionary is shared across server-to-client frames. + // Decompression uses the shared decompressor: uWebSockets' dedicated + // decompressor path can abort connections (close 1006) on valid DEFLATE + // input — see https://github.com/uNetworking/uWebSockets.js/issues/633. + perMessageDeflate: { + compress: "dedicated", + decompress: "shared" + }, open(ws) { Deferred.doneUnsafe(ws.data.deferred, Exit.succeed(ws)) },