ezyfox-server
ezyfox-server copied to clipboard
Use gzip to zip request response
zip request, response has size > 1500 bytes
In http, we have Content-Encoding, Accept-Encoding headers to decide whether we should compress/uncompress the data and the codec to do that (gzip is a case). Is there any equivalent in Socket? I think we should not force user using gzip or 1500b threshold, they can choose deflate, gzip, identity based on their need. Just provide them a configuration and let them decide which is best for them
@anaconda875
- No, it's depending header of package, you can take a look here.
- yes, gzip should be optional.
So please consider this simple scenario: Add one more bit to req header: respCompressionRequired default false. If true, server will use gzip to compress resp (only gzip), don't care about 1500bytes. Add one more bit isCompressed to resp header. In client sdk, add 2 configuration:
- reqCompressionRequired defaul false. If true, client compress req before sending.
- respCompressionRequired default false. Use it to turn the bit on/off.