Compression - nixfanboy/WrathNet GitHub Wiki
Compression
Compression in the WrathNet Engine uses the features of the Compression class in the WrathUtils library to compress and decompress data in the specified format. Having this option enabled will slightly increase latency and resource usage, but will increase compatibility and versatility of the Client. It is not recommended to use compression at all unless data exceeds 512 bytes per packet. If data does exceed 512 bytes per packet, ensure that both the Client and Server receive buffers are set to at least 512 (bytes). Check the Configuration Page for further information.
In order to enable compression in a connection, simply call the enableDataCompression(CompressionType) method in the Client and Server classes. Both the Server and the Client must have this enabled with the same CompressionType in order for compressed data to be sent and received.
The declaration of the Client object should look something like this:
Client c = new Client(wrath.net.Protocol.TCP, new MyCustomClientListener());
c.enableDataCompression(wrath.util.Compression.CompressionType.GZIP);
The declaration of the Server object should look something like this:
Server s = new Server(wrath.net.Protocol.TCP, new MyCustomServerListener());
s.enableDataCompression(wrath.util.Compression.CompressionType.GZIP);