Merge pull request #23095 from jeffreyqw/Compression-example

PHP: Update Compression example
pull/23099/head
Stanley Cheung 5 years ago committed by GitHub
commit 03fc68bb5a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 26
      src/php/README.md

@ -365,4 +365,30 @@ $client = new Helloworld\GreeterClient('localhost:50051', [
]);
```
### Compression
You can customize the compression behavior on the client side, by specifying the following options when constructing your PHP client.
```
Possible values for grpc.default_compression_algorithm:
0 - No compression
1 - Compress with DEFLATE algorithm
2 - Compress with GZIP algorithm
3 - Stream compression with GZIP algorithm
```
```
Possible values for grpc.default_compression_level:
0 - None
1 - Low level
2 - Medium level
3 - High level
```
Here's an example on how you can put them all together:
```
$client = new Helloworld\GreeterClient('localhost:50051', [
'credentials' => Grpc\ChannelCredentials::createInsecure(),
'grpc.default_compression_algorithm' => 2,
'grpc.default_compression_level' => 2,
]);
[Node]:https://github.com/grpc/grpc/tree/master/src/node/examples

Loading…
Cancel
Save