Skip to content

support to configure decompression buffer#188

Open
sanjomo wants to merge 2 commits into
mainfrom
decompress-buffer
Open

support to configure decompression buffer#188
sanjomo wants to merge 2 commits into
mainfrom
decompress-buffer

Conversation

@sanjomo
Copy link
Copy Markdown
Member

@sanjomo sanjomo commented Jun 6, 2026

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 configurable decompression buffer size setting for WebSocket compression, enabling users to optimize network performance based on their specific requirements.

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

coderabbitai Bot commented Jun 6, 2026

Worried about impact? Review this PR in Change Stack to explore blast radius before you approve or request changes.

Review Change Stack

Warning

Review limit reached

@sanjomo, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 50 minutes and 38 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, 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 include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 515c0591-fb92-45a0-a9d0-94d220763f6d

📥 Commits

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

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

Walkthrough

This PR adds WebSocket decompression buffer size as a configurable property. BasicConfiguration introduces a new decompressionBufferSize field with accessors and updates its copy constructor to preserve the value. SocketIOChannelInitializer then passes this configured size to the WebSocketServerCompressionHandler during compression 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 with public getter and setter. The copy constructor is updated to preserve the value when cloning configurations.
WebSocket handler initialization
netty-socketio-core/src/main/java/com/socketio4j/socketio/SocketIOChannelInitializer.java
SocketIOChannelInitializer passes configuration.getDecompressionBufferSize() to the WebSocketServerCompressionHandler constructor to apply the configured decompression buffer size during compression pipeline setup.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Poem

🐰 A buffer size, now configurable and free,
Decompression flows with custom capacity!
From config to handler, the rabbit did wire,
WebSocket compression set just as desired. ✨

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Description check ⚠️ Warning The PR description is largely incomplete. While it mentions the objective (removing deprecated method and introducing decompressionBufferSize), most required sections are empty or unchecked, including Changes Made, Testing, and Checklist items. Fill in the 'Changes Made' section with specific details, check appropriate 'Type of Change' box, complete 'Testing' section, and verify all checklist items before merging.
Docstring Coverage ⚠️ Warning Docstring coverage is 25.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 'support to configure decompression buffer' is clear and directly summarizes the main change: adding configuration support for decompression buffer size in the PR.
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 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.

Copy link
Copy Markdown
Contributor

@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.

🧹 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
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.

1 participant