feat: add concurrent connection limits

Signed-off-by: hgshreyas <hgshreyas.cs24@bmsce.ac.in>
This commit is contained in:
hgshreyas committed 2026-08-09 17:27:47 +05:30
1 parent 1030109efa
commit 9e5e5cffe9
9 files changed
+28 -3

No files matched your search

@@ -34,6 +34,12 @@ same `@Ws` handlers, same rooms/channels everywhere. `app.listen()`, TLS and per
remain Node-only; on Deno/Bun/edge you get `app.fetch` + the runtime's adapter. **Mesh (alpha)
runs on Node, Deno and Bun** — teapot and teacup, in any combination — but not on edge.
**Connection-limit enforcement is Node-only:** `limits.maxConnections` defaults to `1000` and
maps to Node's `server.maxConnections` when the app runs through `app.listen()`. `Deno.serve` and
`Bun.serve` expose no equivalent active-socket cap, so `serveDeno` and `serveBun` cannot enforce
this option. Apply the connection limit at the deployment platform or reverse proxy on those
runtimes.
**Body-size enforcement differs slightly:** on `app.fetch`, an oversized body is read in full
before the `413` is returned, whereas Node aborts mid-stream once the limit is hit — so on
non-Node runtimes, also bound request size at the platform/runtime layer.
@@ -35,6 +35,7 @@ const app = createApp(options);
| Field | Default |
|---|---|
| `maxBodyBytes` | `1_000_000` (→ `413` when exceeded) |
| `maxConnections` | `1000` (Node only; no Deno/Bun equivalent) |
| `requestTimeoutMs` | `30_000` |
| `headersTimeoutMs` | `10_000` |
| `keepAliveTimeoutMs` | `5_000` |