NotionCommotion Posted August 1, 2018 Share Posted August 1, 2018 I wish to compress JSON-RPC messages which are being transferred by a socket. Looks like using http://php.net/manual/en/intro.zlib.php won't work with sockets. Correct? Should one just call the appropriate function before sending and before reading the content? How do I determine which function to use? gzcompress/gzuncompress gzdeflate/gzinflate gzencode/gzdecode zlib_encode/zlib_decode Quote Link to comment Share on other sites More sharing options...
requinix Posted August 1, 2018 Share Posted August 1, 2018 Haven't we gone over this before? You can use whichever one you want. *compress does ZLIB, *flate uses DEFLATE, gz*code uses GZIP with the header, zlib_*code is general-purpose. Consider what it means to have a header, then choose between the other two according to whatever other things you can think of that could possibly, and if you're still unsure then flip a coin. Quote Link to comment Share on other sites More sharing options...
NotionCommotion Posted August 1, 2018 Author Share Posted August 1, 2018 10 hours ago, requinix said: Haven't we gone over this before? You can use whichever one you want. *compress does ZLIB, *flate uses DEFLATE, gz*code uses GZIP with the header, zlib_*code is general-purpose. Consider what it means to have a header, then choose between the other two according to whatever other things you can think of that could possibly, and if you're still unsure then flip a coin. Yeah, we discussed it here where you recommended using gzip/zlib encoding over CBOR or MassagePack. I thought there was more discussion than this but couldn't find it, but just did and apologize for the redundancy. Regarding your comment "Consider what it means to have a header", this is just related to error handling, true? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.