Compression

In general, the term data compression refers to the ability to reduce the number of bits needed to represent data. One way of dealing with this is to provide recurring strings with a reference to the first of these strings through a compression algorithm. Appropriate compression must occur without loss of information.

Two compression types that are very common in HTTP communication are gzip and deflate. Both have been supported in transmit and receive direction in the HTTP driver and the Tc3_IotBase library since TwinCAT version 3.1.4024.11. The methods belong to the group of lossless compression types.

In TwinCAT the compression can be set individually for a FB_IotHttpRequest function block and is passed to it as an input parameter. By default, no compression is used in transmit direction. In receive direction the driver can receive and correctly represent both types of compression without separate settings.

The following diagram shows an HTTP request to the Postman Echo test REST API (see PostmanEcho). The TwinCAT HTTP client notifies the REST API via a header field that both deflate and gzip are supported in receive direction.

Compression 1: