Can anyone point me in the right direction to implement compression with sockets and ReactPHP? I will be sending json rpc messages and using a length prefix to allow it to be parsed.
Is it as simple as just compressing the string before sending it:
$msg=json_encode($msg);
$compressedMsg=gzcompress($msg, 9);
$this->socket->write(pack("V", strlen($compressedMsg)).$compressedMsg);
And then uncompressing it before adding it to the buffer?
$this->socket->on('data', function($dat