We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
$server = new Swoole\WebSocket\Server("0.0.0.0", 9502); $server->set([ 'websocket_compression' => true, 'http_compression_min_length' => 100, ]); $server ->on( 'message', function($server, $frame){ $server ->push( $frame ->fd, base64_encode( random_bytes( 1020 ) ) ); });
抓包发现,reserved 是0,per-message compressed 为false,除非强制指定压缩 SWOOLE_WEBSOCKET_FLAG_COMPRESS | SWOOLE_WEBSOCKET_FLAG_FIN
per-message compressed
SWOOLE_WEBSOCKET_FLAG_COMPRESS | SWOOLE_WEBSOCKET_FLAG_FIN
The text was updated successfully, but these errors were encountered:
执行一下 php --ri swoole 观察是否有 zlib、brotli、zstd 等压缩库的支持,另外客户端是否正确地发生了 accpet 响应
Sorry, something went wrong.
`swoole
Swoole => enabled Author => Swoole Team team@swoole.com Version => 6.0.0 Built => Feb 6 2025 19:37:08 coroutine => enabled with boost asm context epoll => enabled eventfd => enabled signalfd => enabled cpu_affinity => enabled spinlock => enabled rwlock => enabled sockets => enabled openssl => OpenSSL 3.0.2 15 Mar 2022 dtls => enabled http2 => enabled json => enabled curl-native => enabled pcre => enabled zlib => 1.2.11 brotli => E16777225/D16777225 mutex_timedlock => enabled pthread_barrier => enabled futex => enabled`
我仔细看了下手册,swoole文档说,要自己针对消息加SWOOLE_WEBSOCKET_FLAG_COMPRESS 标志才会压缩。zlib库装了的,客户端请求和服务端响应都带了permessage-deflate
你的客户端是 Chrome 还是其他?HTTP 请求的 sec-websocket-extensions 头需要携带 permessage-deflate 才会启用压缩。
请将客户端完整 HTTP 头部发一下
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
抓包发现,reserved 是0,
per-message compressed
为false,除非强制指定压缩SWOOLE_WEBSOCKET_FLAG_COMPRESS | SWOOLE_WEBSOCKET_FLAG_FIN
The text was updated successfully, but these errors were encountered: