Closed hafung closed 2 years ago
how to enable WEBSOCKET_EXTENSIONS: permessage-deflate And set server_max_window_bits
Gatewayworker has no such configuration.
If you want to compress data. Here is the example.
start_gateway.php
...
use Workerman\Protocols\Websocket;
$gateway = new Gateway("websocket://0.0.0.0:7272");
$gateway->onConnect = function($connection) {
$connection->websocketType = Websocket::BINARY_TYPE_ARRAYBUFFER;
};
...
Events.php
...
$data = 'hello world';
$data = gzcompress($data);
Gateway::sendToAll($data);
...
Thanks! It helps
please give me some guide, because i can't find any useful in offical doc
OR how to compress data in order to save Bandwidth?
thanks!