Merge pull request #1161 from oneslash/documentation

(doc): add compression documentation part of #402
This commit is contained in:
Michael Lumish 2019-12-02 10:46:28 -08:00 committed by GitHub
commit bc9d10fb8d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 31 additions and 0 deletions

31
doc/compression.md Normal file
View File

@ -0,0 +1,31 @@
# Compression
## Client side
The preferred method for configuring message compression on a client is to pass `options` when the client object is instantiated.
These two options control compression behavior:
**grpc.default_compression_algorithm** (int)
Default compression algorithm for the channel, applies to sending messages.
Possible values for this option are:
- `0` - No compression
- `1` - Compress with DEFLATE algorithm
- `2` - Compress with GZIP algorithm
- `3` - Stream compression with GZIP algorithm
**grpc.default_compression_level** (int)
Default compression level for the channel, applies to receiving messages.
Possible values for this option are:
- `0` - None
- `1` - Low level
- `2` - Medium level
- `3` - High level
### Code example
```javascript
client = new ExampleClient("example.com", credentials.createInsecure(), {'grpc.default_compression_algorithm': 2, 'grpc.default_compression_level': 2});
```