Skip to content

fix: only use COMPRESS flag when compression is enabled#28

Merged
abnegate merged 1 commit intomainfrom
fix-conditional-compression
Feb 5, 2026
Merged

fix: only use COMPRESS flag when compression is enabled#28
abnegate merged 1 commit intomainfrom
fix-conditional-compression

Conversation

@abnegate
Copy link
Member

@abnegate abnegate commented Feb 5, 2026

Summary

  • Only include SWOOLE_WEBSOCKET_FLAG_COMPRESS when websocket_compression is enabled in config
  • Fixes compatibility issues with Swoole 6.1.6 when clients don't support permessage-deflate

Problem

The SWOOLE_WEBSOCKET_FLAG_COMPRESS flag was hardcoded in the send() method, regardless of whether compression was actually enabled. With Swoole 6.1.6, this caused issues when sending messages to clients that don't support the permessage-deflate extension.

Solution

Check the websocket_compression config value before including the compress flag in the push flags.

🤖 Generated with Claude Code

Summary by CodeRabbit

  • Chores

    • Updated .gitignore to exclude macOS system metadata files.
  • New Features

    • WebSocket adapter now supports message compression when enabled in configuration, improving bandwidth efficiency for WebSocket connections.

The SWOOLE_WEBSOCKET_FLAG_COMPRESS flag was hardcoded in send(),
which could cause issues with Swoole 6.1.6 when clients don't
support permessage-deflate compression.

Now the COMPRESS flag is only included when websocket_compression
is explicitly enabled in the server config.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@coderabbitai
Copy link

coderabbitai bot commented Feb 5, 2026

Walkthrough

This pull request contains two changes: adding macOS metadata file (.DS_Store) to the .gitignore and refactoring the flag handling logic in the Swoole WebSocket adapter's send() method. The Swoole change extracts hardcoded WebSocket flags into a conditional variable that applies the compression flag only when websocket_compression is enabled in configuration.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main change: making the COMPRESS flag conditional based on compression configuration, which directly addresses the primary problem in the changeset.

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

✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix-conditional-compression

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.

abnegate added a commit to appwrite/appwrite that referenced this pull request Feb 5, 2026
Temporarily use dev branch (fix-conditional-compression) that only
applies SWOOLE_WEBSOCKET_FLAG_COMPRESS when compression is enabled.

This fixes websocket compatibility issues with Swoole 6.1.6.

See: utopia-php/websocket#28

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@abnegate abnegate merged commit d230de8 into main Feb 5, 2026
7 checks passed
@abnegate abnegate deleted the fix-conditional-compression branch February 5, 2026 13:40
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