Skip to content

Feat: Add proper documentation for both Websockets and HTTP capabilities#33

Merged
VikramAditya33 merged 1 commit into
mainfrom
doc
Apr 26, 2026
Merged

Feat: Add proper documentation for both Websockets and HTTP capabilities#33
VikramAditya33 merged 1 commit into
mainfrom
doc

Conversation

@VikramAditya33
Copy link
Copy Markdown
Collaborator

@VikramAditya33 VikramAditya33 commented Apr 25, 2026

Add Comprehensive HTTP and WebSocket Documentation

Added complete documentation covering all HTTP and WebSocket features with usage examples and API references.

HTTP Documentation

  • Server.md - Server setup, initialization patterns, shared/separate port modes, SSL configuration, migration guide
  • Request.md - Request API, headers, query params, body parsing, cookies
  • Response.md - Response methods, streaming, compression, caching, ETags
  • Routing.md - Route registration, path parameters, wildcards
  • Body-Parsing.md - JSON, URL-encoded, multipart, raw, text parsing
  • Multipart.md - File uploads and multipart form handling
  • Static-Files.md - Static file serving with caching and range requests
  • Middleware.md - Guards, Pipes, Filters, Interceptors
  • Compression.md - Request/response compression
  • CORS.md - Cross-origin resource sharing configuration

WebSocket Documentation

  • Adapter.md - UwsAdapter configuration, methods, lifecycle management
  • Socket.md - UwsSocket API, emit, send, room operations
  • Broadcasting.md - BroadcastOperator, targeted messaging patterns
  • Decorators.md - @SubscribeMessage, @MessageBody, @ConnectedSocket
  • Rooms.md - Room management, join/leave operations
  • Middleware.md - Guards, Pipes, Filters for WebSocket handlers
  • Exceptions.md - WsException and error handling
  • Lifecycle.md - Gateway lifecycle, connection/disconnection events, internal handler management

Closes #28

Summary by CodeRabbit

  • Documentation
    • Repositioned uWestJS as a combined HTTP + WebSocket platform with a rewritten overview and condensed quick-starts for HTTP, WebSocket, and shared-port setups.
    • Added comprehensive HTTP guides (server, routing, request/response, body parsing, multipart, CORS, compression, middleware, static files).
    • Added comprehensive WebSocket guides (adapter, socket API, decorators, rooms, broadcasting, lifecycle, middleware, exceptions).
    • Replaced the monolithic API reference with focused, linked documentation pages.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Apr 25, 2026

Warning

Rate limit exceeded

@VikramAditya33 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 47 minutes and 7 seconds before requesting another review.

Your organization is not enrolled in usage-based pricing. Contact your admin to enable usage-based pricing to continue reviews beyond the rate limit, or try again in 47 minutes and 7 seconds.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: ba5a1c57-1d75-4745-85ea-6604a5792faa

📥 Commits

Reviewing files that changed from the base of the PR and between 4fa9d52 and 4c178f2.

📒 Files selected for processing (20)
  • README.md
  • docs/api.md
  • docs/http/Body-Parsing.md
  • docs/http/CORS.md
  • docs/http/Compression.md
  • docs/http/Middleware.md
  • docs/http/Multipart.md
  • docs/http/Request.md
  • docs/http/Response.md
  • docs/http/Routing.md
  • docs/http/Server.md
  • docs/http/Static-Files.md
  • docs/websocket/Adapter.md
  • docs/websocket/Broadcasting.md
  • docs/websocket/Decorators.md
  • docs/websocket/Exceptions.md
  • docs/websocket/Lifecycle.md
  • docs/websocket/Middleware.md
  • docs/websocket/Rooms.md
  • docs/websocket/Socket.md
📝 Walkthrough

Walkthrough

Replaces a WebSocket-focused README with a combined HTTP+WebSocket platform overview, deletes the monolithic docs/api.md, and adds 18 focused documentation pages covering HTTP server, request/response, body parsing, CORS, compression, static files, multipart, routing, middleware, and WebSocket adapter/socket/decorators/rooms/broadcasting/lifecycle/middleware/exceptions.

Changes

Cohort / File(s) Summary
README Restructuring
README.md
Rewritten to describe unified HTTP + WebSocket platform, updated tagline/benchmarks, new features lists for HTTP and WebSocket, condensed quick-starts for UwsPlatformAdapter (HTTP), UwsAdapter (WebSocket), and shared-port wiring; adds links to new HTTP/WebSocket docs and trims prior deep migration/how-to sections.
Removed Monolithic API
docs/api.md
Deleted the single-file API reference (all prior API/type documentation removed).
HTTP Docs (10 files)
docs/http/Body-Parsing.md, docs/http/CORS.md, docs/http/Compression.md, docs/http/Middleware.md, docs/http/Multipart.md, docs/http/Request.md, docs/http/Response.md, docs/http/Routing.md, docs/http/Server.md, docs/http/Static-Files.md
Added comprehensive HTTP documentation: request/response surfaces, body parsing (JSON, urlencoded, raw, text, multipart), CORS options and strategies, compression (response/request, brotli/gzip/deflate), Nest-style middleware patterns (guards/pipes/filters), multipart streaming via busboy, routing and parameter handling, UwsPlatformAdapter options/lifecycle/static-file serving, examples, limits, and best practices.
WebSocket Docs (8 files)
docs/websocket/Adapter.md, docs/websocket/Broadcasting.md, docs/websocket/Decorators.md, docs/websocket/Exceptions.md, docs/websocket/Lifecycle.md, docs/websocket/Middleware.md, docs/websocket/Rooms.md, docs/websocket/Socket.md
Added WebSocket documentation: UwsAdapter options/APIs, broadcasting and BroadcastOperator semantics, NestJS gateway/decorator behavior, WsException and filters, lifecycle hooks mapping, WebSocket middleware patterns (guards/pipes/filters), room management patterns, and UwsSocket API including backpressure and streaming examples.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Poem

🐰 I hopped through docs both web and ws,
From CORS to rooms, I stitched each gloss.
Pages neat, examples bright and keen,
HTTP and sockets, a unified scene.
Hop in — the platform's freshly seen!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change—adding comprehensive documentation for both HTTP and WebSocket capabilities—which matches the substantial documentation additions in the changeset.
Linked Issues check ✅ Passed The PR fully addresses issue #28 by providing comprehensive documentation covering all HTTP features (Server, Request, Response, Routing, Body-Parsing, Multipart, Static-Files, Middleware, Compression, CORS) and WebSocket features (Adapter, Socket, Broadcasting, Decorators, Rooms, Middleware, Exceptions, Lifecycle).
Out of Scope Changes check ✅ Passed All changes are documentation-only, directly supporting the PR objectives. README updates reference the new docs and reorganize content to reflect v2.0.0 capabilities; deprecated docs/api.md is removed as part of the documentation restructuring. No unrelated code changes are present.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch doc

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 16

♻️ Duplicate comments (1)
docs/http/Static-Files.md (1)

156-230: ⚠️ Potential issue | 🟡 Minor

Note: This maxAge issue affects multiple examples throughout this file.

The same milliseconds vs seconds issue appears in many other examples:

  • Line 159: maxAge: 31536000 (should be 31536000000 for 1 year)
  • Line 220: maxAge: 31536000 (should be 31536000000 for 1 year)
  • Lines 420, 598: Similar issues

All numeric maxAge values throughout the documentation need to be multiplied by 1000, or use the string format ('1h', '1d', '1y').

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/http/Static-Files.md` around lines 156 - 230, The documentation examples
for app.useStaticAssets use maxAge values in seconds (e.g., 31536000) but the
API expects milliseconds; update every occurrence of maxAge in this file
(examples that call app.useStaticAssets) to multiply numeric values by 1000
(e.g., 31536000000) or switch to accepted duration strings like '1y'/'1h'/'1d';
search for all usages of maxAge within examples (including the blocks showing No
Caching, Short-term Caching, Long-term Caching, Environment-Based Caching and
any other code samples) and consistently apply the fix so response header
examples remain correct.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/http/Body-Parsing.md`:
- Around line 379-397: The example catch block in the handleUpload handler
conflicts with the note that uWestJS rejects oversized bodies before handlers
run; either remove/replace the try/catch example or update it to explicitly show
a hypothetical/custom parser case. Specifically, update the sample around async
handleUpload(`@Body`() data: any) to either (A) remove the platform-level "Body
size limit exceeded" catch and keep only custom validation logic, or (B) add a
clear comment and heading stating this is a hypothetical custom-parser scenario
where an in-handler error with message 'Body size limit exceeded' is thrown and
then rethrown as a PayloadTooLargeException. Ensure references to handleUpload,
the error.message check for 'Body size limit exceeded', and
PayloadTooLargeException remain consistent with the chosen approach.
- Around line 355-363: The example claims per-route disabling but doesn't show
the API; update the snippet to use the real route option that disables parsing
(e.g., add the route option to the decorator like `@Post`('no-parse', {
bodyParser: false }) and keep the handler handleNoParse(`@Req`() req: UwsRequest)
to show accessing the raw request), or if your framework uses a dedicated
decorator, replace the example with that symbol (e.g., `@DisableBodyParser`) and
the same handler; ensure the docs include the exact symbol used (bodyParser:
false on `@Post` or `@DisableBodyParser`) and a one-line note about accessing raw
stream via req.

In `@docs/http/Compression.md`:
- Around line 218-220: Add language identifiers to the two fenced code blocks
that contain HTTP header examples (e.g., the block starting with
"Accept-Encoding: gzip, deflate, br" and the other header snippet at lines
287-292) to satisfy markdownlint MD040; update the triple-backtick fences to
include a language tag such as http or text (for example, ```http) so the header
snippets are properly highlighted.

In `@docs/http/CORS.md`:
- Around line 72-92: Update the CorsOptions interface docs to reflect the actual
supported origin forms and correct methods defaults: modify the origin
description for CorsOptions/origin to include boolean (true to allow all, false
to deny all) and allow the callback to return Promise<boolean> as well as
boolean, and change the methods default note to indicate context-dependent
defaults (HTTP context default: ['GET','HEAD','PUT','PATCH','POST','DELETE'];
WebSocket context default: ['GET','POST']) while keeping the existing string |
string[] signature reference for methods.

In `@docs/http/Middleware.md`:
- Around line 19-25: The docs claim support for `@UseInterceptors`() and list
interceptor "before/after" execution but the HTTP route pipeline (the HTTP route
registry / request pipeline implementation) does not execute interceptors;
either remove or mark the interceptor sections as "planned" or add interceptor
execution into the pipeline. Specifically, either (A) remove or annotate the
interceptor-related docs and examples (references: Middleware.md entries
mentioning `@UseInterceptors`, the middleware execution order description, and the
decorator examples) to state "planned/not implemented", or (B) implement an
interceptor stage in the HTTP request pipeline by adding interceptor execution
around the handler in the HTTP route registry so the sequence becomes guards →
pipes → interceptors (before) → handler → interceptors (after) → filters; update
Middleware.md to match. Ensure the symbols `@UseInterceptors` and the HTTP route
registry/request pipeline code are updated consistently.

In `@docs/http/Multipart.md`:
- Around line 53-54: The code uses the user-controlled field.file.filename
directly when constructing filepath (const filepath = path.join('./uploads',
`${Date.now()}-${field.file.filename}`)), which permits path traversal; fix by
sanitizing the filename before joining—use path.basename(field.file.filename) or
otherwise generate a server-side filename/UUID and then build the path (update
the filepath construction and any related uses like writeStream creation) so
only the sanitized or generated name is appended to './uploads'.

In `@docs/http/Request.md`:
- Around line 58-66: Update the docs examples to match the runtime API: change
any examples that show req.url including the query string to use path-only
values, remove usages that access properties off req.query (since req.query is a
raw query string), and replace parsed-parameter accesses with req.queryParams;
specifically update example blocks referencing url, query, and queryParams
(e.g., the sections showing req.url, req.query, and parsed params) so they show
req.url as path-only, req.query as the raw query string, and parsed values
accessed via req.queryParams.

In `@docs/http/Static-Files.md`:
- Around line 185-213: The examples for app.useStaticAssets incorrectly pass
maxAge in seconds; according to StaticFileOptions maxAge is in milliseconds.
Update the two examples using app.useStaticAssets (the first call with 'public'
and the second with 'public/assets') to use milliseconds (3600000 for 1 hour and
31536000000 for 1 year) or replace them with the string forms '1h' and '1y' so
the Cache-Control headers are generated correctly.
- Around line 90-151: Update the StaticFileOptions documentation to reflect the
actual supported types and semantics: change maxAge from just number to "number
| string" and note accepted string formats like '1d', '2h', '30m', '5s' and that
values represent seconds when numeric; expand etag from boolean to accept true |
'weak' (default), 'strong' (strong ETags for If-Range/resumable downloads), or
false (disable ETags); keep references to the interface name StaticFileOptions
and the properties maxAge and etag so reviewers can locate the changes.

In `@docs/websocket/Exceptions.md`:
- Around line 523-526: The "Use Different Filters" example has a stray
code-fence after `@Catch`(WsException) that breaks the block; remove the extra
"```typescript" immediately following "@Catch(WsException)" so the
`@Catch`(WsException) annotation and the subsequent import/ExceptionFilter code
are inside a single fenced code block (ensure the example begins with a single
"```typescript" before the annotation and ends with a matching closing fence);
search for the WsException/@Catch(WsException) snippet to locate and fix it.
- Around line 39-60: The docs for WsException currently document a two-argument
constructor but the implemented class WsException uses a single-object
parameter; update the documentation to reflect the real constructor signature
(new WsException({ message, error? })) by replacing the parameter list and
"Parameters" section with an object shape describing `message` and optional
`error`, and change all examples (including the other occurrence around lines
75-80) to use the object form (e.g., new WsException({ message: '...', error:
'CODE' })) so they match the implementation in
src/websocket/exceptions/ws-exception.ts.

In `@docs/websocket/Rooms.md`:
- Around line 373-375: The import for WsException is inconsistent—replace the
WsException import from '@nestjs/websockets' with the same source used elsewhere
(import WsException from 'uwestjs') so the top-of-file imports
(WebSocketGateway, SubscribeMessage, MessageBody, ConnectedSocket, UwsSocket)
align with the rest of the WebSocket docs; update the import statement that
references WsException to use 'uwestjs' and keep the other imports unchanged.

In `@README.md`:
- Line 254: Remove the stray fenced code block delimiter (the standalone "```")
that was left in README.md; locate the lone fence marker introduced around the
end of the file (the isolated "```" shown in the diff) and delete it so the
Markdown structure is valid and MD040 is resolved.
- Line 69: Update the README entry "Middleware Support - Guards, Pipes, Filters,
and Interceptors for WebSocket handlers" to remove or qualify "Interceptors" so
it matches the actual capabilities documented in ./docs/websocket/Middleware.md;
edit the string in README.md to either drop "Interceptors" or add a
parenthetical like "(not currently supported for WebSocket handlers)" and ensure
the change references the same "Middleware Support" line so readers aren't
misled.
- Around line 196-201: The README example currently passes TLS values inside an
ssl object but the implementation (PlatformOptions / UwsPlatformAdapter) expects
TLS fields at the top level; update the UwsPlatformAdapter initialization
example to supply key_file_name, cert_file_name (and any other TLS fields like
ca_file_name if applicable) as top-level properties on the options object passed
to the UwsPlatformAdapter constructor so the example matches the PlatformOptions
shape used by the adapter.
- Around line 169-173: The README example uses the wrong option key for shared
uWS wiring; update the UwsAdapter instantiation to pass the uWS instance under
the documented UwsAdapterOptions key `uwsApp` (not `httpAdapter`) so TypeScript
accepts it—modify the example where `new UwsAdapter(app, { httpAdapter, path:
'/ws' })` is shown to use `uwsApp` (e.g., `{ uwsApp: <yourUwsInstance>, path:
'/ws' }`) and ensure imports/variable names in the snippet match the rest of the
example; this aligns the README with the `UwsAdapterOptions` interface and fixes
type errors.

---

Duplicate comments:
In `@docs/http/Static-Files.md`:
- Around line 156-230: The documentation examples for app.useStaticAssets use
maxAge values in seconds (e.g., 31536000) but the API expects milliseconds;
update every occurrence of maxAge in this file (examples that call
app.useStaticAssets) to multiply numeric values by 1000 (e.g., 31536000000) or
switch to accepted duration strings like '1y'/'1h'/'1d'; search for all usages
of maxAge within examples (including the blocks showing No Caching, Short-term
Caching, Long-term Caching, Environment-Based Caching and any other code
samples) and consistently apply the fix so response header examples remain
correct.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 622a9a4c-2e74-48ad-959d-358fdea4622e

📥 Commits

Reviewing files that changed from the base of the PR and between 13085ef and dec083f.

📒 Files selected for processing (20)
  • README.md
  • docs/api.md
  • docs/http/Body-Parsing.md
  • docs/http/CORS.md
  • docs/http/Compression.md
  • docs/http/Middleware.md
  • docs/http/Multipart.md
  • docs/http/Request.md
  • docs/http/Response.md
  • docs/http/Routing.md
  • docs/http/Server.md
  • docs/http/Static-Files.md
  • docs/websocket/Adapter.md
  • docs/websocket/Broadcasting.md
  • docs/websocket/Decorators.md
  • docs/websocket/Exceptions.md
  • docs/websocket/Lifecycle.md
  • docs/websocket/Middleware.md
  • docs/websocket/Rooms.md
  • docs/websocket/Socket.md
💤 Files with no reviewable changes (1)
  • docs/api.md

Comment thread docs/http/Body-Parsing.md Outdated
Comment thread docs/http/Body-Parsing.md
Comment thread docs/http/Compression.md Outdated
Comment thread docs/http/CORS.md
Comment thread docs/http/Middleware.md Outdated
Comment thread docs/websocket/Rooms.md Outdated
Comment thread README.md Outdated
Comment thread README.md
Comment thread README.md
Comment thread README.md Outdated
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 6

♻️ Duplicate comments (1)
docs/http/Static-Files.md (1)

110-142: ⚠️ Potential issue | 🟠 Major

StaticFileOptions API here is out of sync with implementation.

src/http/handlers/static/static-file-handler.ts defines:

  • etag?: boolean (not 'weak' | 'strong')
  • caching?: boolean (not cacheControl)
  • dotfiles includes 'ignore_files', which is missing here.

Please update the interface and dependent examples so docs match runtime behavior.

Also applies to: 125-130

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/http/Static-Files.md` around lines 110 - 142, The docs for
StaticFileOptions are out of sync with the runtime: update the docs to match the
implementation in src/http/handlers/static/static-file-handler.ts by changing
etag to a boolean (etag?: boolean), renaming cacheControl to caching (caching?:
boolean) and mentioning the default behavior, and add the missing dotfiles value
'ignore_files' to the dotfiles union; ensure any examples and descriptions
elsewhere in this doc that reference etag/cacheControl/dotfiles reflect these
exact symbol names and allowed values from StaticFileOptions so docs match
runtime behavior.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@docs/http/Compression.md`:
- Around line 322-325: The docs incorrectly state the default decompressed
request limit as 10MB; update the text to reflect the actual default of 100KB by
changing the "Default limit" line to "100KB decompressed" and, if present
elsewhere, ensure references to the configuration option inflateLimit (or any
default constant named inflateLimit) match the implementation and mention that
inflateLimit defaults to 100KB. Also add a brief note linking the policy to the
inflateLimit config name so readers can override it if needed.
- Around line 50-63: The docs for CompressionOptions are out of sync with the
actual interface in src/http/handlers/compression/compression-handler.ts: update
the documentation for CompressionOptions to match the implemented contract by
adding the inflate and inflateLimit properties, changing brotli from an object
to brotli?: boolean, and removing memLevel, strategy and enabled if those are
not present in the implementation (or alternatively add those fields to the
implementation if you intend the docs to be authoritative); ensure the
documented filter signature and threshold/level fields match the types/names
used in CompressionOptions in compression-handler.ts and apply the same
corrections to the other affected section (lines ~174-200).

In `@docs/http/Server.md`:
- Around line 388-390: Update the documentation for the Server.listen overloads
to reflect the Node-style error-first callback used by the implementation:
change both occurrences of callback?: () => void to callback?: (err?: Error) =>
void (or equivalent phrasing) and update any examples to handle the error
parameter (e.g., check for err and handle startup failure) so callers can
respond to startup errors from listen.
- Around line 324-330: The docs incorrectly state the default for etag as false;
update the Server.md documentation to match the runtime default used by
HttpOptions by changing the Default from `false` to `'weak'` and ensure the
Options list remains the same (false, 'weak', 'strong') so readers see the
documented default (`'weak'`) consistent with the HttpOptions runtime behavior.
- Around line 527-539: The documented StaticFileOptions is out of sync with the
implementation: update the interface docs for StaticFileOptions to match the
runtime types and units by changing maxAge to "number | string" with number
representing milliseconds (or a duration string), replace cacheControl with
caching?: boolean, and include the actual dotfiles enum values (allow | deny |
ignore | ignore_files). Also audit and update all example usages (lines noted
around 514-522, 527-539, 559-561, 665-666) that pass second-based numeric maxAge
values so they supply either millisecond numbers or string durations instead of
seconds. Ensure you reference the same symbol names (StaticFileOptions, maxAge,
caching, dotfiles) when making edits.

In `@docs/http/Static-Files.md`:
- Around line 50-57: The fenced code block showing the directory tree (starting
with "public/ ├── index.html ...") and other similar blocks flagged (lines
around 197-201, 215-217, 241-243, etc.) are missing language identifiers; update
each fenced code block to include an appropriate language tag (e.g., ```text for
file trees, ```http for request/response examples, or ```json/```html where
applicable) so they satisfy MD040 and improve readability—locate the blocks by
their content (the "public/" filesystem tree and the other listed examples) and
add the matching language token after the opening backticks.

---

Duplicate comments:
In `@docs/http/Static-Files.md`:
- Around line 110-142: The docs for StaticFileOptions are out of sync with the
runtime: update the docs to match the implementation in
src/http/handlers/static/static-file-handler.ts by changing etag to a boolean
(etag?: boolean), renaming cacheControl to caching (caching?: boolean) and
mentioning the default behavior, and add the missing dotfiles value
'ignore_files' to the dotfiles union; ensure any examples and descriptions
elsewhere in this doc that reference etag/cacheControl/dotfiles reflect these
exact symbol names and allowed values from StaticFileOptions so docs match
runtime behavior.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 9adf90d4-8f42-478c-94b6-190ee475ee82

📥 Commits

Reviewing files that changed from the base of the PR and between dec083f and 3711552.

📒 Files selected for processing (20)
  • README.md
  • docs/api.md
  • docs/http/Body-Parsing.md
  • docs/http/CORS.md
  • docs/http/Compression.md
  • docs/http/Middleware.md
  • docs/http/Multipart.md
  • docs/http/Request.md
  • docs/http/Response.md
  • docs/http/Routing.md
  • docs/http/Server.md
  • docs/http/Static-Files.md
  • docs/websocket/Adapter.md
  • docs/websocket/Broadcasting.md
  • docs/websocket/Decorators.md
  • docs/websocket/Exceptions.md
  • docs/websocket/Lifecycle.md
  • docs/websocket/Middleware.md
  • docs/websocket/Rooms.md
  • docs/websocket/Socket.md
💤 Files with no reviewable changes (1)
  • docs/api.md
✅ Files skipped from review due to trivial changes (10)
  • docs/http/Middleware.md
  • docs/websocket/Lifecycle.md
  • docs/http/Response.md
  • docs/websocket/Exceptions.md
  • docs/http/Multipart.md
  • docs/websocket/Middleware.md
  • docs/websocket/Socket.md
  • docs/http/Routing.md
  • docs/http/CORS.md
  • docs/websocket/Rooms.md
🚧 Files skipped from review as they are similar to previous changes (3)
  • docs/websocket/Decorators.md
  • docs/http/Body-Parsing.md
  • docs/http/Request.md

Comment thread docs/http/Compression.md
Comment thread docs/http/Compression.md Outdated
Comment on lines +322 to +325
Decompressed request size is limited to prevent memory exhaustion:

**Default limit:** 10MB decompressed

Copy link
Copy Markdown

@coderabbitai coderabbitai Bot Apr 26, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

Incorrect default decompression limit.

Line 324 says “Default limit: 10MB decompressed”, but implementation docs indicate inflateLimit defaults to 100KB. This changes security posture and expected behavior significantly.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@docs/http/Compression.md` around lines 322 - 325, The docs incorrectly state
the default decompressed request limit as 10MB; update the text to reflect the
actual default of 100KB by changing the "Default limit" line to "100KB
decompressed" and, if present elsewhere, ensure references to the configuration
option inflateLimit (or any default constant named inflateLimit) match the
implementation and mention that inflateLimit defaults to 100KB. Also add a brief
note linking the policy to the inflateLimit config name so readers can override
it if needed.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the actual default in the implementation is 10MB, and the documentation is already accurate

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧩 Analysis chain

Let me verify the actual default value in the implementation before responding.


🏁 Script executed:

#!/bin/bash
# Search for inflate limit, decompress limit, or related constants
rg -rn -i "inflateLimit|inflate_limit|decompressedLimit|decompress.*limit|10mb|10 \* 1024|10485760|100kb|100 \* 1024|102400" --type=ts --type=js -C2

Length of output: 7212


🏁 Script executed:

#!/bin/bash
# Get the actual default constant for maxInflatedBodySize
cat src/http/handlers/compression/compression-handler.ts | grep -n "maxInflatedBodySize" -A2 -B2

Length of output: 1194


@VikramAditya33, you are correct — I apologize for the incorrect review comment. The implementation in src/http/handlers/compression/compression-handler.ts (Line 67) clearly sets:

maxInflatedBodySize: 10 * 1024 * 1024, // 10MB

and the JSDoc on Line 52 also confirms @default 10485760 (10MB). The documentation is accurate as written. Sorry for the noise!


✏️ Learnings added
Learnt from: VikramAditya33
Repo: VikramAditya33/uWestJS PR: 33
File: docs/http/Compression.md:322-325
Timestamp: 2026-04-26T10:25:59.800Z
Learning: In uWestJS (`src/http/handlers/compression/compression-handler.ts`), the default value of `maxInflatedBodySize` (the decompressed request body size limit used to protect against decompression bombs) is `10 * 1024 * 1024` (10MB), not 100KB. The corresponding documentation in `docs/http/Compression.md` correctly states "Default limit: 10MB decompressed".

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

Comment thread docs/http/Server.md Outdated
Comment thread docs/http/Server.md Outdated
Comment thread docs/http/Server.md
Comment thread docs/http/Static-Files.md Outdated
@VikramAditya33 VikramAditya33 force-pushed the doc branch 2 times, most recently from 364c80b to 4fa9d52 Compare April 26, 2026 11:32
Copy link
Copy Markdown

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
docs/websocket/Adapter.md (1)

62-76: Document all options from the UwsAdapterOptions interface.

The interface definition includes maxBackpressure, closeOnBackpressureLimit, sendPingsAutomatically, and maxLifetime, but these options lack detailed documentation sections below. Based on the actual interface in src/websocket/interfaces/uws-options.interface.ts, these are important configuration options that users need to understand.

📚 Add missing option documentation

Add detailed sections for the missing options after the path section (around line 181):

+### maxBackpressure
+
+typescript +maxBackpressure?: number +
+
+Maximum buffered bytes per WebSocket connection. When a client is slow to receive data, messages are buffered. If the buffer exceeds this limit, behavior depends on closeOnBackpressureLimit.
+
+Default: 1048576 (1MB)
+
+Example:
+
+typescript +// Allow 5MB buffer per connection +new UwsAdapter(app, { maxBackpressure: 5 * 1024 * 1024 }); +
+
+### closeOnBackpressureLimit
+
+typescript +closeOnBackpressureLimit?: boolean +
+
+Close connection when backpressure limit is exceeded. When true, connections exceeding maxBackpressure are automatically closed. When false, messages continue to buffer (may cause memory issues with slow clients).
+
+Default: false
+
+Example:
+
+```typescript
+new UwsAdapter(app, {

  • maxBackpressure: 1024 * 1024,
  • closeOnBackpressureLimit: true, // Close slow clients
    +});
    +```

+### sendPingsAutomatically
+
+typescript +sendPingsAutomatically?: boolean +
+
+Automatically send ping frames to keep connections alive. When enabled, the server sends WebSocket ping frames to detect dead connections. Clients must respond with pong frames or the connection will be closed after idleTimeout seconds.
+
+Default: true
+
+Example:
+
+```typescript
+new UwsAdapter(app, {

  • sendPingsAutomatically: true,
  • idleTimeout: 120, // Close if no pong within 120s
    +});
    +```

+### maxLifetime
+
+typescript +maxLifetime?: number +
+
+Maximum connection lifetime in minutes. Maximum number of minutes a WebSocket connection may remain open before being automatically closed. Set to 0 to disable.
+
+Default: 0 (disabled)
+
+Example:
+
+typescript +// Force reconnection every 30 minutes +new UwsAdapter(app, { maxLifetime: 30 }); +
+

cors


</details>

<details>
<summary>🤖 Prompt for AI Agents</summary>

Verify each finding against the current code and only fix it if needed.

In @docs/websocket/Adapter.md around lines 62 - 76, Document the four missing
UwsAdapterOptions fields — maxBackpressure, closeOnBackpressureLimit,
sendPingsAutomatically, and maxLifetime — by adding sections after the existing
path section that declare each option's TypeScript signature, describe its
behavior, state the default value, and include a short usage example; ensure the
sections reference the exact option names and match types used in the
UwsAdapterOptions interface so consumers can map docs to the UwsAdapterOptions
interface and related code (e.g., maxBackpressure?: number,
closeOnBackpressureLimit?: boolean, sendPingsAutomatically?: boolean,
maxLifetime?: number).


</details>

</blockquote></details>

</blockquote></details>

<details>
<summary>🤖 Prompt for all review comments with AI agents</summary>

Verify each finding against the current code and only fix it if needed.

Inline comments:
In @docs/websocket/Lifecycle.md:

  • Around line 95-109: The docs examples use the wrong class name: replace usages
    of UwsPlatformAdapter with the WebSocket adapter UwsAdapter and update the
    constructor signature to match UwsAdapter's API (pass the app/context as the
    first arg and options as second) so the two snippets that currently reference
    UwsPlatformAdapter (lines showing maxBackpressure/closeOnBackpressureLimit and
    sendPingsAutomatically/idleTimeout) instead instantiate UwsAdapter(app, { ... })
    to reflect correct usage.

Nitpick comments:
In @docs/websocket/Adapter.md:

  • Around line 62-76: Document the four missing UwsAdapterOptions fields —
    maxBackpressure, closeOnBackpressureLimit, sendPingsAutomatically, and
    maxLifetime — by adding sections after the existing path section that declare
    each option's TypeScript signature, describe its behavior, state the default
    value, and include a short usage example; ensure the sections reference the
    exact option names and match types used in the UwsAdapterOptions interface so
    consumers can map docs to the UwsAdapterOptions interface and related code
    (e.g., maxBackpressure?: number, closeOnBackpressureLimit?: boolean,
    sendPingsAutomatically?: boolean, maxLifetime?: number).

</details>

<details>
<summary>🪄 Autofix (Beta)</summary>

Fix all unresolved CodeRabbit comments on this PR:

- [ ] <!-- {"checkboxId": "4b0d0e0a-96d7-4f10-b296-3a18ea78f0b9"} --> Push a commit to this branch (recommended)
- [ ] <!-- {"checkboxId": "ff5b1114-7d8c-49e6-8ac1-43f82af23a33"} --> Create a new PR with the fixes

</details>

---

<details>
<summary>ℹ️ Review info</summary>

<details>
<summary>⚙️ Run configuration</summary>

**Configuration used**: defaults

**Review profile**: CHILL

**Plan**: Pro

**Run ID**: `8be9a8f4-561f-4c70-9fea-d534c35418bd`

</details>

<details>
<summary>📥 Commits</summary>

Reviewing files that changed from the base of the PR and between 37115521b208a696e6f6da4e6282abbf1be9ebe3 and 4fa9d524b147bc2c3b6f44890d733d87642fb864.

</details>

<details>
<summary>📒 Files selected for processing (20)</summary>

* `README.md`
* `docs/api.md`
* `docs/http/Body-Parsing.md`
* `docs/http/CORS.md`
* `docs/http/Compression.md`
* `docs/http/Middleware.md`
* `docs/http/Multipart.md`
* `docs/http/Request.md`
* `docs/http/Response.md`
* `docs/http/Routing.md`
* `docs/http/Server.md`
* `docs/http/Static-Files.md`
* `docs/websocket/Adapter.md`
* `docs/websocket/Broadcasting.md`
* `docs/websocket/Decorators.md`
* `docs/websocket/Exceptions.md`
* `docs/websocket/Lifecycle.md`
* `docs/websocket/Middleware.md`
* `docs/websocket/Rooms.md`
* `docs/websocket/Socket.md`

</details>

<details>
<summary>💤 Files with no reviewable changes (1)</summary>

* docs/api.md

</details>

<details>
<summary>✅ Files skipped from review due to trivial changes (13)</summary>

* docs/http/Multipart.md
* docs/http/Response.md
* docs/websocket/Rooms.md
* docs/websocket/Decorators.md
* docs/http/Routing.md
* docs/websocket/Socket.md
* docs/http/Request.md
* docs/http/Body-Parsing.md
* docs/websocket/Exceptions.md
* docs/websocket/Middleware.md
* docs/http/Static-Files.md
* docs/http/CORS.md
* README.md

</details>

<details>
<summary>🚧 Files skipped from review as they are similar to previous changes (1)</summary>

* docs/http/Middleware.md

</details>

</details>

<!-- This is an auto-generated comment by CodeRabbit for review status -->

Comment thread docs/websocket/Lifecycle.md
@VikramAditya33 VikramAditya33 merged commit 021f5b2 into main Apr 26, 2026
3 checks passed
@VikramAditya33 VikramAditya33 deleted the doc branch April 26, 2026 11:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add documentation for v2.0.0

1 participant