Skip to content

support to configure decompression buffer#188

Merged
NeatGuyCoding merged 5 commits into
mainfrom
decompress-buffer
Jun 10, 2026
Merged

support to configure decompression buffer#188
NeatGuyCoding merged 5 commits into
mainfrom
decompress-buffer

Conversation

@sanjomo

@sanjomo sanjomo commented Jun 6, 2026

Copy link
Copy Markdown
Member

removed deprecated method which always support unlimited buffer, user can use decompressionBufferSize to set the limits

Description

Brief description of the changes in this PR.

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Code refactoring
  • Test improvements
  • Build/tooling changes

Related Issue

Closes #(issue number)

Changes Made

Testing

  • All existing tests pass
  • New tests added for new functionality
  • Tests pass locally with mvn test
  • Integration tests pass (if applicable)

Checklist

  • Code follows project coding standards
  • Self-review completed
  • Code is commented where necessary
  • Documentation updated (if needed)
  • Commit messages follow conventional format
  • No merge conflicts
  • All CI checks pass

Additional Notes

Any additional information, screenshots, or context that reviewers should know.

Summary by CodeRabbit

  • New Features

    • Added a configurable decompression buffer size for WebSocket compression to let users tune performance.
  • Bug Fixes

    • Configuration now rejects negative buffer sizes, preventing invalid settings and runtime errors.

removed deprecated method which always support unlimited buffer, user can use decompressionBufferSize to set the limits
@coderabbitai

coderabbitai Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e306dfe8-853f-41fb-80be-d88dcca03991

📥 Commits

Reviewing files that changed from the base of the PR and between 41f9b48 and ad023a9.

📒 Files selected for processing (1)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java
🚧 Files skipped from review as they are similar to previous changes (1)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java

📝 Walkthrough

Walkthrough

This PR adds a configurable WebSocket decompression buffer size: BasicConfiguration gains a decompressionBufferSize field with getter/setter and copy-constructor support; SocketIOChannelInitializer passes the configured size into WebSocketServerCompressionHandler during pipeline setup.

Changes

WebSocket Decompression Buffer Configuration

Layer / File(s) Summary
Configuration property and accessors
netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java
BasicConfiguration adds a protected decompressionBufferSize field (default 0), updates the copy constructor to preserve it, and exposes getDecompressionBufferSize() and setDecompressionBufferSize(int) (setter rejects negative values).
WebSocket handler initialization
netty-socketio-core/src/main/java/com/socketio4j/socketio/SocketIOChannelInitializer.java
SocketIOChannelInitializer constructs WebSocketServerCompressionHandler with configuration.getDecompressionBufferSize() when WebSocket compression is enabled.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A tiny field in config I sow,
A buffer for websockets to grow,
Copied with care and checked for right,
Passed to the handler to do its might,
Hop, decompress — the bytes now flow.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description mentions the deprecated method removal and decompressionBufferSize feature, but most template sections (Type of Change, Changes Made, Testing, Checklist) are empty with only placeholder checkboxes and dashes. Complete the template by selecting the Type of Change, filling in the Changes Made list, and checking off applicable Testing and Checklist items.
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (3 passed)
Check name Status Explanation
Title check ✅ Passed The title directly and clearly summarizes the main change: adding support to configure the decompression buffer size.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch decompress-buffer

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java (1)

76-78: ⚡ Quick win

Add JavaDoc and input validation for the new public API.

The setter lacks documentation explaining:

  • What this parameter controls (WebSocket decompression buffer size limit)
  • What the default value of 0 means (unlimited? use Netty's default?)
  • What values are acceptable (positive integers only? any specific limits?)

Additionally, consider adding validation to reject invalid values such as negative numbers.

📝 Suggested documentation and validation
+    /**
+     * Set the maximum decompression buffer size for WebSocket compression.
+     * Used to limit memory consumption during WebSocket message decompression.
+     * <p>
+     * Default is <code>0</code> which means [specify: unlimited or use Netty default]
+     *
+     * `@param` decompressionBufferSize - buffer size in bytes, or 0 for [unlimited/default]
+     */
     public void setDecompressionBufferSize(int decompressionBufferSize) {
+        if (decompressionBufferSize < 0) {
+            throw new IllegalArgumentException("decompressionBufferSize must be non-negative");
+        }
         this.decompressionBufferSize = decompressionBufferSize;
     }
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java`
around lines 76 - 78, Add JavaDoc to
BasicConfiguration.setDecompressionBufferSize describing that this controls the
WebSocket decompression buffer size limit, what a default of 0 means (e.g.,
unlimited or use Netty's default—state which), and the acceptable range
(positive integers only). Add input validation in setDecompressionBufferSize to
reject negative values (throw IllegalArgumentException with a clear message) and
document the behavior for 0 and positive values; reference the field
decompressionBufferSize and the setter setDecompressionBufferSize in the comment
so reviewers can locate the change.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java`:
- Around line 76-78: Add JavaDoc to
BasicConfiguration.setDecompressionBufferSize describing that this controls the
WebSocket decompression buffer size limit, what a default of 0 means (e.g.,
unlimited or use Netty's default—state which), and the acceptable range
(positive integers only). Add input validation in setDecompressionBufferSize to
reject negative values (throw IllegalArgumentException with a clear message) and
document the behavior for 0 and positive values; reference the field
decompressionBufferSize and the setter setDecompressionBufferSize in the comment
so reviewers can locate the change.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: c58faabb-e6c8-4788-a90d-517fbac10392

📥 Commits

Reviewing files that changed from the base of the PR and between 5677847 and 41f9b48.

📒 Files selected for processing (2)
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/BasicConfiguration.java
  • netty-socketio-core/src/main/java/com/socketio4j/socketio/SocketIOChannelInitializer.java

@sanjomo sanjomo requested a review from NeatGuyCoding June 6, 2026 09:17
@NeatGuyCoding NeatGuyCoding merged commit 887c6fd into main Jun 10, 2026
9 checks passed
@NeatGuyCoding NeatGuyCoding deleted the decompress-buffer branch June 10, 2026 07:06
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.

2 participants