Skip to content

Compression Overview

tylerje edited this page Oct 23, 2014 · 1 revision

ServiceWire allows you to compress large payloads. By default, compression is turned off. If you have a very fast network, using compression will generally not help you. However, if you are transmitting large amounts of data over a slower connection, e.g. the Internet, then you may want to consider turning on compression and setting the compression size threashold as shown below.

 var useCompression = true;
 var compressionThreshold = 131072; //128KB

 var nphost = new NpHost(pipeName, logger, stats);

 nphost.UseCompression = useCompression;
 nphost.CompressionThreshold = compressionThreshold;

 nphost.AddService<INetTester>(tester);
 nphost.AddService<IMyTester>(mytester);
 nphost.Open();
When enabled as shown in the above code, parameters or return values that exceed 128KB will be Gzipped before going over the wire.
Clone this wiki locally